summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 18:58:03 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 18:58:03 +0000
commitf58c8cc4dd6d74524a668880929c95b63c6588af (patch)
treecfbbf6056bc9fb22228c3113df20b591f3c96738
parent2735e369f4c0b7fb9a9d90862cf14dee9c99de53 (diff)
downloadchromium_src-f58c8cc4dd6d74524a668880929c95b63c6588af.zip
chromium_src-f58c8cc4dd6d74524a668880929c95b63c6588af.tar.gz
chromium_src-f58c8cc4dd6d74524a668880929c95b63c6588af.tar.bz2
GPUProcessor uses NPN_PluginThreadAsyncCall to schedule future command processing instead of Chromium MessageLoop.
Now it'll work in other browsers. TEST=none BUG=none Review URL: http://codereview.chromium.org/219041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27223 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--o3d/gpu_plugin/command_buffer.h1
-rw-r--r--o3d/gpu_plugin/gpu_processor.cc10
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser.cc7
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser.h5
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser_mock.h6
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser_stub.cc9
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser_stub.h4
7 files changed, 36 insertions, 6 deletions
diff --git a/o3d/gpu_plugin/command_buffer.h b/o3d/gpu_plugin/command_buffer.h
index 7583def..6565470 100644
--- a/o3d/gpu_plugin/command_buffer.h
+++ b/o3d/gpu_plugin/command_buffer.h
@@ -8,7 +8,6 @@
#include <set>
#include <vector>
-#include "base/message_loop.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
#include "o3d/gpu_plugin/np_utils/default_np_object.h"
diff --git a/o3d/gpu_plugin/gpu_processor.cc b/o3d/gpu_plugin/gpu_processor.cc
index 201bef8..bb74617 100644
--- a/o3d/gpu_plugin/gpu_processor.cc
+++ b/o3d/gpu_plugin/gpu_processor.cc
@@ -8,6 +8,12 @@
namespace o3d {
namespace gpu_plugin {
+namespace {
+void InvokeProcessCommands(void* data) {
+ static_cast<GPUProcessor*>(data)->ProcessCommands();
+}
+} // namespace anonymous
+
void GPUProcessor::ProcessCommands() {
if (command_buffer_->GetErrorStatus())
return;
@@ -37,9 +43,7 @@ void GPUProcessor::ProcessCommands() {
command_buffer_->SetGetOffset(static_cast<int32>(parser_->get()));
if (!parser_->IsEmpty()) {
- MessageLoop::current()->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &GPUProcessor::ProcessCommands));
+ NPBrowser::get()->PluginThreadAsyncCall(npp_, InvokeProcessCommands, this);
}
}
diff --git a/o3d/gpu_plugin/np_utils/np_browser.cc b/o3d/gpu_plugin/np_utils/np_browser.cc
index ac25c1e..a1eda6d 100644
--- a/o3d/gpu_plugin/np_utils/np_browser.cc
+++ b/o3d/gpu_plugin/np_utils/np_browser.cc
@@ -103,5 +103,12 @@ NPObject* NPBrowser::GetWindowNPObject(NPP npp) {
return NULL;
}
}
+
+void NPBrowser::PluginThreadAsyncCall(NPP npp,
+ PluginThreadAsyncCallProc callback,
+ void* data) {
+ netscape_funcs_->pluginthreadasynccall(npp, callback, data);
+}
+
} // 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 21b6133..3f11fa1 100644
--- a/o3d/gpu_plugin/np_utils/np_browser.h
+++ b/o3d/gpu_plugin/np_utils/np_browser.h
@@ -71,6 +71,11 @@ class NPBrowser {
virtual NPObject* GetWindowNPObject(NPP npp);
+ typedef void (*PluginThreadAsyncCallProc)(void* data);
+ virtual void PluginThreadAsyncCall(NPP npp,
+ PluginThreadAsyncCallProc callback,
+ void* data);
+
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 9db951e..4cfe25d 100644
--- a/o3d/gpu_plugin/np_utils/np_browser_mock.h
+++ b/o3d/gpu_plugin/np_utils/np_browser_mock.h
@@ -29,8 +29,10 @@ class MockNPBrowser : public StubNPBrowser {
&MockNPBrowser::ConcreteCreateObject));
}
- MOCK_METHOD2(CreateObject, NPObject*(NPP, const NPClass*));
- MOCK_METHOD1(GetWindowNPObject, NPObject*(NPP));
+ 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));
};
} // 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 5c673ac..7e27a2b 100644
--- a/o3d/gpu_plugin/np_utils/np_browser_stub.cc
+++ b/o3d/gpu_plugin/np_utils/np_browser_stub.cc
@@ -4,6 +4,7 @@
#include "o3d/gpu_plugin/np_utils/np_browser_stub.h"
#include "base/logging.h"
+#include "base/message_loop.h"
namespace o3d {
namespace gpu_plugin {
@@ -103,5 +104,13 @@ bool StubNPBrowser::Invoke(NPP npp,
NPObject* StubNPBrowser::GetWindowNPObject(NPP npp) {
return NULL;
}
+
+void StubNPBrowser::PluginThreadAsyncCall(
+ NPP npp,
+ PluginThreadAsyncCallProc callback,
+ void* data) {
+ MessageLoop::current()->PostTask(FROM_HERE,
+ NewRunnableFunction(callback, data));
+}
} // 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 3e1288c..4fd8767 100644
--- a/o3d/gpu_plugin/np_utils/np_browser_stub.h
+++ b/o3d/gpu_plugin/np_utils/np_browser_stub.h
@@ -67,6 +67,10 @@ class StubNPBrowser : public NPBrowser {
virtual NPObject* GetWindowNPObject(NPP npp);
+ virtual void PluginThreadAsyncCall(NPP npp,
+ PluginThreadAsyncCallProc callback,
+ void* data);
+
private:
DISALLOW_COPY_AND_ASSIGN(StubNPBrowser);
};