[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
steveblock at google.com
steveblock at google.com
Thu Feb 4 21:23:34 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 58ca0d6f44393200a44ac3dab20ff211489dd882
Author: steveblock at google.com <steveblock at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 21 19:36:42 2010 +0000
[Android] bindings/v8/NPV8Object.cpp does not compile on Android
https://bugs.webkit.org/show_bug.cgi?id=33608
Patch by Andrei Popescu <andreip at google.com> on 2010-01-21
Reviewed by David Levin.
Use the standard WebKit header in bridge/npruntime.h.
Include PlatformBridge.h instead of ChroimiumBridge.h.
Add popupsAllowed() method to PlatformBridge.h on Android.
Add ARRAYSIZE_UNSAFE to PlatformBridge.h on Android.
No new tests, fixing the build.
* bindings/v8/NPV8Object.cpp:
(_NPN_Evaluate):
* bindings/v8/NPV8Object.h:
* platform/android/PlatformBridge.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7d950de..1f559a9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,25 @@
Reviewed by David Levin.
+ [Android] bindings/v8/NPV8Object.cpp does not compile on Android
+ https://bugs.webkit.org/show_bug.cgi?id=33608
+
+ Use the standard WebKit header in bridge/npruntime.h.
+ Include PlatformBridge.h instead of ChroimiumBridge.h.
+ Add popupsAllowed() method to PlatformBridge.h on Android.
+ Add ARRAYSIZE_UNSAFE to PlatformBridge.h on Android.
+
+ No new tests, fixing the build.
+
+ * bindings/v8/NPV8Object.cpp:
+ (_NPN_Evaluate):
+ * bindings/v8/NPV8Object.h:
+ * platform/android/PlatformBridge.h:
+
+2010-01-21 Andrei Popescu <andreip at google.com>
+
+ Reviewed by David Levin.
+
Add PlatformBridge.h header and a typedef to give ChromiumBridge a new name: PlatformBridge.
https://bugs.webkit.org/show_bug.cgi?id=33917
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp
index cb6c688..202a3af 100644
--- a/WebCore/bindings/v8/NPV8Object.cpp
+++ b/WebCore/bindings/v8/NPV8Object.cpp
@@ -28,7 +28,7 @@
#include "NPV8Object.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include "DOMWindow.h"
#include "Frame.h"
#include "OwnArrayPtr.h"
@@ -242,7 +242,7 @@ bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments,
bool _NPN_Evaluate(NPP npp, NPObject* npObject, NPString* npScript, NPVariant* result)
{
- bool popupsAllowed = WebCore::ChromiumBridge::popupsAllowed(npp);
+ bool popupsAllowed = WebCore::PlatformBridge::popupsAllowed(npp);
return _NPN_EvaluateHelper(npp, popupsAllowed, npObject, npScript, result);
}
diff --git a/WebCore/bindings/v8/NPV8Object.h b/WebCore/bindings/v8/NPV8Object.h
index 91a2d08..b9b376e 100644
--- a/WebCore/bindings/v8/NPV8Object.h
+++ b/WebCore/bindings/v8/NPV8Object.h
@@ -31,7 +31,15 @@
#define NPV8Object_h
#include "V8Index.h"
+#if PLATFORM(CHROMIUM)
+// FIXME: Chromium uses a different npruntime.h, which is in
+// the Chromium source repository under third_party/npapi/bindings.
+// The Google-specific changes in that file should probably be
+// moved into bridge/npruntime.h, guarded by an #if PlATFORM(CHROMIUM).
#include "bindings/npruntime.h"
+#else
+#include "bridge/npruntime.h" // Use WebCore version for Android and other ports.
+#endif
#include <v8.h>
namespace WebCore {
diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h
index bd2a313..d3cbc98 100644
--- a/WebCore/platform/android/PlatformBridge.h
+++ b/WebCore/platform/android/PlatformBridge.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2009, The Android Open Source Project
+ * Copyright 2009, 2010, The Android Open Source Project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,10 +27,56 @@
#define PlatformBridge_h
#include "KURL.h"
+#include "npapi.h"
#include "PlatformString.h"
#include <wtf/Vector.h>
+// V8 bindings use the ARRAYSIZE_UNSAFE macro. This macro was copied
+// from http://src.chromium.org/viewvc/chrome/trunk/src/base/basictypes.h
+//
+// ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize,
+// but can be used on anonymous types or types defined inside
+// functions. It's less safe than arraysize as it accepts some
+// (although not all) pointers. Therefore, you should use arraysize
+// whenever possible.
+//
+// The expression ARRAYSIZE_UNSAFE(a) is a compile-time constant of type
+// size_t.
+//
+// ARRAYSIZE_UNSAFE catches a few type errors. If you see a compiler error
+//
+// "warning: division by zero in ..."
+//
+// when using ARRAYSIZE_UNSAFE, you are (wrongfully) giving it a pointer.
+// You should only use ARRAYSIZE_UNSAFE on statically allocated arrays.
+//
+// The following comments are on the implementation details, and can
+// be ignored by the users.
+//
+// ARRAYSIZE_UNSAFE(arr) works by inspecting sizeof(arr) (the # of bytes in
+// the array) and sizeof(*(arr)) (the # of bytes in one array
+// element). If the former is divisible by the latter, perhaps arr is
+// indeed an array, in which case the division result is the # of
+// elements in the array. Otherwise, arr cannot possibly be an array,
+// and we generate a compiler error to prevent the code from
+// compiling.
+//
+// Since the size of bool is implementation-defined, we need to cast
+// !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final
+// result has type size_t.
+//
+// This macro is not perfect as it wrongfully accepts certain
+// pointers, namely where the pointer size is divisible by the pointee
+// size. Since all our code has to go through a 32-bit compiler,
+// where a pointer is 4 bytes, this means all pointers to a type whose
+// size is 3 or greater than 4 will be (righteously) rejected.
+
+#define ARRAYSIZE_UNSAFE(a) \
+ ((sizeof(a) / sizeof(*(a))) / \
+ static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
+
+
namespace WebCore {
// An interface to the embedding layer, which has the ability to answer
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list