summaryrefslogtreecommitdiffstats
path: root/o3d/gpu_plugin/np_utils
diff options
context:
space:
mode:
Diffstat (limited to 'o3d/gpu_plugin/np_utils')
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser.cc12
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser.h4
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser_mock.h7
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser_stub.cc8
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser_stub.h3
-rw-r--r--o3d/gpu_plugin/np_utils/np_headers.h6
-rw-r--r--o3d/gpu_plugin/np_utils/webkit_browser.h9
7 files changed, 42 insertions, 7 deletions
diff --git a/o3d/gpu_plugin/np_utils/np_browser.cc b/o3d/gpu_plugin/np_utils/np_browser.cc
index c86104d..f6f8189 100644
--- a/o3d/gpu_plugin/np_utils/np_browser.cc
+++ b/o3d/gpu_plugin/np_utils/np_browser.cc
@@ -5,6 +5,12 @@
#include "o3d/gpu_plugin/np_utils/np_browser.h"
#include "base/logging.h"
+#if defined(O3D_IN_CHROME)
+#include "webkit/glue/plugins/nphostapi.h"
+#else
+#include "npupp.h"
+#endif
+
namespace o3d {
namespace gpu_plugin {
@@ -109,5 +115,11 @@ void NPBrowser::PluginThreadAsyncCall(NPP npp,
netscape_funcs_->pluginthreadasynccall(npp, callback, data);
}
+void* NPBrowser::MapMemory(NPP npp,
+ NPObject* object,
+ size_t* size) {
+ return netscape_funcs_->mapmemory(npp, object, size);
+}
+
} // namespace gpu_plugin
} // namespace o3d
diff --git a/o3d/gpu_plugin/np_utils/np_browser.h b/o3d/gpu_plugin/np_utils/np_browser.h
index dc50d81..04429d4 100644
--- a/o3d/gpu_plugin/np_utils/np_browser.h
+++ b/o3d/gpu_plugin/np_utils/np_browser.h
@@ -76,6 +76,10 @@ class NPBrowser {
PluginThreadAsyncCallProc callback,
void* data);
+ virtual void* MapMemory(NPP npp,
+ NPObject* object,
+ size_t* size);
+
private:
static NPBrowser* browser_;
NPBrowser* previous_browser_;
diff --git a/o3d/gpu_plugin/np_utils/np_browser_mock.h b/o3d/gpu_plugin/np_utils/np_browser_mock.h
index 4cfe25d..e638809 100644
--- a/o3d/gpu_plugin/np_utils/np_browser_mock.h
+++ b/o3d/gpu_plugin/np_utils/np_browser_mock.h
@@ -29,10 +29,17 @@ class MockNPBrowser : public StubNPBrowser {
&MockNPBrowser::ConcreteCreateObject));
}
+ void ConcretePluginThreadAsyncCall(NPP npp,
+ PluginThreadAsyncCallProc callback,
+ void* data) {
+ return StubNPBrowser::PluginThreadAsyncCall(npp, callback, data);
+ }
+
MOCK_METHOD2(CreateObject, NPObject*(NPP npp, const NPClass* cl));
MOCK_METHOD1(GetWindowNPObject, NPObject*(NPP cpp));
MOCK_METHOD3(PluginThreadAsyncCall,
void(NPP npp, PluginThreadAsyncCallProc callback, void* data));
+ MOCK_METHOD3(MapMemory, void*(NPP npp, NPObject* object, size_t* size));
};
} // namespace gpu_plugin
diff --git a/o3d/gpu_plugin/np_utils/np_browser_stub.cc b/o3d/gpu_plugin/np_utils/np_browser_stub.cc
index 7e27a2b..d6d3e87 100644
--- a/o3d/gpu_plugin/np_utils/np_browser_stub.cc
+++ b/o3d/gpu_plugin/np_utils/np_browser_stub.cc
@@ -112,5 +112,13 @@ void StubNPBrowser::PluginThreadAsyncCall(
MessageLoop::current()->PostTask(FROM_HERE,
NewRunnableFunction(callback, data));
}
+
+void* StubNPBrowser::MapMemory(NPP npp,
+ NPObject* object,
+ size_t* size) {
+ *size = 0;
+ return NULL;
+}
+
} // namespace gpu_plugin
} // namespace o3d
diff --git a/o3d/gpu_plugin/np_utils/np_browser_stub.h b/o3d/gpu_plugin/np_utils/np_browser_stub.h
index b5c9cff..ce4908c 100644
--- a/o3d/gpu_plugin/np_utils/np_browser_stub.h
+++ b/o3d/gpu_plugin/np_utils/np_browser_stub.h
@@ -68,6 +68,9 @@ class StubNPBrowser : public NPBrowser {
virtual void PluginThreadAsyncCall(NPP npp,
PluginThreadAsyncCallProc callback,
void* data);
+ virtual void* MapMemory(NPP npp,
+ NPObject* object,
+ size_t* size);
private:
DISALLOW_COPY_AND_ASSIGN(StubNPBrowser);
diff --git a/o3d/gpu_plugin/np_utils/np_headers.h b/o3d/gpu_plugin/np_utils/np_headers.h
index 49e496c..6a2a3c6 100644
--- a/o3d/gpu_plugin/np_utils/np_headers.h
+++ b/o3d/gpu_plugin/np_utils/np_headers.h
@@ -16,10 +16,4 @@
#undef utf8characters
#undef utf8length
-#if defined(O3D_IN_CHROME)
-#include "webkit/glue/plugins/nphostapi.h"
-#else
-#include "npupp.h"
-#endif
-
#endif // O3D_GPU_PLUGIN_NP_UTILS_NP_HEADERS_H_
diff --git a/o3d/gpu_plugin/np_utils/webkit_browser.h b/o3d/gpu_plugin/np_utils/webkit_browser.h
index 70e0782..86cfa3e 100644
--- a/o3d/gpu_plugin/np_utils/webkit_browser.h
+++ b/o3d/gpu_plugin/np_utils/webkit_browser.h
@@ -99,7 +99,14 @@ class WebKitBrowser : public NPBrowser {
}
virtual NPObject* GetWindowNPObject(NPP npp) {
- return NULL;
+ NPObject* window;
+ if (NPERR_NO_ERROR == NPN_GetValue(npp,
+ NPNVWindowNPObject,
+ &window)) {
+ return window;
+ } else {
+ return NULL;
+ }
}
private: