summaryrefslogtreecommitdiffstats
path: root/o3d/plugin
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 21:18:06 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 21:18:06 +0000
commit782ce0676a7ab49b411d44a953637ad4805bc4ea (patch)
tree8e9c2b6734753d4a9886f3ce78dc94381e5c88bc /o3d/plugin
parent397189ee96ffd74d8edd01c2dcfa5708981948cd (diff)
downloadchromium_src-782ce0676a7ab49b411d44a953637ad4805bc4ea.zip
chromium_src-782ce0676a7ab49b411d44a953637ad4805bc4ea.tar.gz
chromium_src-782ce0676a7ab49b411d44a953637ad4805bc4ea.tar.bz2
Rolled forward O3D's Chromium DEPS to match the Skia roll-forward in
the last CL, which broke the Linux build due to version mismatches. Thanks to tschmelcher for help with the Linux changes. Built and tested O3D on Windows, Linux and Mac OS X. BUG=none TEST=none Review URL: http://codereview.chromium.org/2952001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51895 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin')
-rw-r--r--o3d/plugin/cross/np_v8_bridge.cc62
-rw-r--r--o3d/plugin/cross/np_v8_bridge.h5
-rw-r--r--o3d/plugin/cross/out_of_memory.cc24
-rw-r--r--o3d/plugin/cross/out_of_memory.h1
4 files changed, 55 insertions, 37 deletions
diff --git a/o3d/plugin/cross/np_v8_bridge.cc b/o3d/plugin/cross/np_v8_bridge.cc
index 9e8c752..ced02d2 100644
--- a/o3d/plugin/cross/np_v8_bridge.cc
+++ b/o3d/plugin/cross/np_v8_bridge.cc
@@ -1264,27 +1264,6 @@ v8::Handle<Value> NPV8Bridge::V8PropertySetter(
return v8_result;
}
-v8::Handle<v8::Boolean> NPV8Bridge::V8PropertyQuery(Local<Value> v8_name,
- const AccessorInfo& info) {
- Local<Object> holder = info.Holder();
- NPV8Bridge* bridge = static_cast<NPV8Bridge*>(
- Local<External>::Cast(
- holder->GetInternalField(V8_NP_OBJECT_BRIDGE))->Value());
- Context::Scope scope(bridge->script_context());
-
- NPObjectPtr<NPObject> np_object = bridge->V8ToNPObject(holder);
- if (np_object.IsNull())
- return v8::Handle<v8::Boolean>();
-
- NPIdentifier np_name = V8ToNPIdentifier(v8_name);
- if (np_name == NULL)
- return v8::Handle<v8::Boolean>();
-
- bool has = NPN_HasProperty(bridge->npp_, np_object.Get(), np_name) ||
- NPN_HasMethod(bridge->npp_, np_object.Get(), np_name);
- return v8::Boolean::New(has);
-}
-
v8::Handle<v8::Boolean> NPV8Bridge::V8PropertyDeleter(
Local<Value> v8_name,
const AccessorInfo& info) {
@@ -1322,10 +1301,28 @@ v8::Handle<Value> NPV8Bridge::V8NamedPropertySetter(Local<v8::String> v8_name,
return V8PropertySetter(v8_name, v8_value, info);
}
-v8::Handle<v8::Boolean> NPV8Bridge::V8NamedPropertyQuery(
+v8::Handle<v8::Integer> NPV8Bridge::V8NamedPropertyQuery(
Local<v8::String> v8_name,
const AccessorInfo& info) {
- return V8PropertyQuery(v8_name, info);
+ Local<Object> holder = info.Holder();
+ NPV8Bridge* bridge = static_cast<NPV8Bridge*>(
+ Local<External>::Cast(
+ holder->GetInternalField(V8_NP_OBJECT_BRIDGE))->Value());
+ Context::Scope scope(bridge->script_context());
+
+ NPObjectPtr<NPObject> np_object = bridge->V8ToNPObject(holder);
+ if (np_object.IsNull())
+ return v8::Handle<v8::Integer>();
+
+ NPIdentifier np_name = V8ToNPIdentifier(v8_name);
+ if (np_name == NULL)
+ return v8::Handle<v8::Integer>();
+
+ bool has = NPN_HasProperty(bridge->npp_, np_object.Get(), np_name) ||
+ NPN_HasMethod(bridge->npp_, np_object.Get(), np_name);
+ if (!has)
+ return v8::Handle<v8::Integer>();
+ return v8::Integer::New(0);
}
v8::Handle<v8::Boolean> NPV8Bridge::V8NamedPropertyDeleter(
@@ -1365,7 +1362,24 @@ v8::Handle<Value> NPV8Bridge::V8IndexedPropertySetter(
v8::Handle<v8::Boolean> NPV8Bridge::V8IndexedPropertyQuery(
uint32_t index,
const AccessorInfo& info) {
- return V8PropertyQuery(Integer::New(index), info);
+ Local<Object> holder = info.Holder();
+ NPV8Bridge* bridge = static_cast<NPV8Bridge*>(
+ Local<External>::Cast(
+ holder->GetInternalField(V8_NP_OBJECT_BRIDGE))->Value());
+ Context::Scope scope(bridge->script_context());
+
+ NPObjectPtr<NPObject> np_object = bridge->V8ToNPObject(holder);
+ if (np_object.IsNull())
+ return v8::Handle<v8::Boolean>();
+
+ Local<Value> v8_name = Integer::New(index);
+ NPIdentifier np_name = V8ToNPIdentifier(v8_name);
+ if (np_name == NULL)
+ return v8::Handle<v8::Boolean>();
+
+ bool has = NPN_HasProperty(bridge->npp_, np_object.Get(), np_name) ||
+ NPN_HasMethod(bridge->npp_, np_object.Get(), np_name);
+ return v8::Boolean::New(has);
}
v8::Handle<v8::Boolean> NPV8Bridge::V8IndexedPropertyDeleter(
diff --git a/o3d/plugin/cross/np_v8_bridge.h b/o3d/plugin/cross/np_v8_bridge.h
index 1227b5d..e3ce65c 100644
--- a/o3d/plugin/cross/np_v8_bridge.h
+++ b/o3d/plugin/cross/np_v8_bridge.h
@@ -332,9 +332,6 @@ class NPV8Bridge {
v8::Local<v8::Value> v8_value,
const v8::AccessorInfo& info);
- static v8::Handle<v8::Boolean> V8PropertyQuery(v8::Local<v8::Value> v8_name,
- const v8::AccessorInfo& info);
-
static v8::Handle<v8::Boolean> V8PropertyDeleter(
v8::Local<v8::Value> v8_name,
const v8::AccessorInfo& info);
@@ -348,7 +345,7 @@ class NPV8Bridge {
v8::Local<v8::Value> v8_value,
const v8::AccessorInfo& info);
- static v8::Handle<v8::Boolean> V8NamedPropertyQuery(
+ static v8::Handle<v8::Integer> V8NamedPropertyQuery(
v8::Local<v8::String> v8_name,
const v8::AccessorInfo& info);
diff --git a/o3d/plugin/cross/out_of_memory.cc b/o3d/plugin/cross/out_of_memory.cc
index 47937f1..db71932 100644
--- a/o3d/plugin/cross/out_of_memory.cc
+++ b/o3d/plugin/cross/out_of_memory.cc
@@ -31,11 +31,18 @@
// This file implements a failure handler for the new
-// operator and malloc.
+// operator and malloc for Windows and Mac. (On Linux,
+// chrome's libbase.a implements one already.)
-// TODO: This does not currently work on linux. The replacement
-// operator new, malloc, etc do not take priority over those declared in
-// the standard libraries.
+#include "plugin/cross/out_of_memory.h"
+
+#ifdef OS_LINUX
+namespace o3d {
+bool SetupOutOfMemoryHandler() {
+ return true;
+}
+}
+#else
#include <stdio.h>
#include <stdlib.h>
@@ -54,7 +61,6 @@
#include <dlfcn.h>
#endif
-#include "plugin/cross/out_of_memory.h"
#include "plugin/cross/plugin_metrics.h"
#ifdef _MSC_VER
@@ -71,7 +77,6 @@ namespace {
// run after abort() to do its work.
const size_t kReserveSize = 1024 * 256;
void* g_reserve;
-} // namespace anonymous
// This is called when a memory allocation fails in the plugin. Note
// that it will not be called if a memory allocation fails in another
@@ -119,6 +124,7 @@ int HandleOutOfMemory(size_t size) {
}
return 0;
}
+} // namespace anonymous
bool SetupOutOfMemoryHandler() {
#ifdef _MSC_VER
@@ -141,7 +147,7 @@ bool SetupOutOfMemoryHandler() {
}
} // namespace o3d
-#if defined(OS_MACOSX) || defined(OS_LINUX)
+#if defined(OS_MACOSX)
namespace {
void* dlsym_helper(const char* symbol_name) {
void* ptr = dlsym(RTLD_NEXT, symbol_name);
@@ -228,4 +234,6 @@ wchar_t* wcsdup(const wchar_t* ptr) {
return result;
}
}
-#endif // defined(OS_MACOSX) || defined(OS_LINUX)
+#endif // defined(OS_MACOSX)
+#endif // defined(OS_LINUX)
+
diff --git a/o3d/plugin/cross/out_of_memory.h b/o3d/plugin/cross/out_of_memory.h
index aef1b1e..03a321f 100644
--- a/o3d/plugin/cross/out_of_memory.h
+++ b/o3d/plugin/cross/out_of_memory.h
@@ -37,7 +37,6 @@
#define O3D_PLUGIN_CROSS_OUT_OF_MEMORY_H_
namespace o3d {
-void HandleOutOfMemory();
bool SetupOutOfMemoryHandler();
}