summaryrefslogtreecommitdiffstats
path: root/o3d/gpu_plugin/gpu_plugin_object.cc
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-03 19:41:16 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-03 19:41:16 +0000
commit1b8f411d2daf5212f678ea1493b6bd5416d0c8ad (patch)
treee10297c768c79c2cecd2fb3b49fb5a1ae98a20d1 /o3d/gpu_plugin/gpu_plugin_object.cc
parentb6aa587dc3d810cbc73ad9f3f3ec062cb231d869 (diff)
downloadchromium_src-1b8f411d2daf5212f678ea1493b6bd5416d0c8ad.zip
chromium_src-1b8f411d2daf5212f678ea1493b6bd5416d0c8ad.tar.gz
chromium_src-1b8f411d2daf5212f678ea1493b6bd5416d0c8ad.tar.bz2
Exracted CommandBuffer class from GPUPluginObject.
TEST=none BUG=none Review URL: http://codereview.chromium.org/200005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/gpu_plugin/gpu_plugin_object.cc')
-rw-r--r--o3d/gpu_plugin/gpu_plugin_object.cc32
1 files changed, 6 insertions, 26 deletions
diff --git a/o3d/gpu_plugin/gpu_plugin_object.cc b/o3d/gpu_plugin/gpu_plugin_object.cc
index c83dd03..9187f08 100644
--- a/o3d/gpu_plugin/gpu_plugin_object.cc
+++ b/o3d/gpu_plugin/gpu_plugin_object.cc
@@ -10,7 +10,9 @@
namespace o3d {
namespace gpu_plugin {
+namespace {
const int32 kCommandBufferSize = 1024;
+} // namespace anonymous
const NPUTF8 GPUPluginObject::kPluginType[] =
"application/vnd.google.chrome.gpu-plugin";
@@ -61,7 +63,7 @@ NPError GPUPluginObject::Destroy(NPSavedData** saved) {
NPBrowser::get()->UnmapSharedMemory(npp(), shared_memory_);
}
- command_buffer_object_ = NPObjectPointer<NPObject>();
+ command_buffer_object_ = NPObjectPointer<CommandBuffer>();
status_ = DESTROYED;
@@ -82,31 +84,9 @@ NPObjectPointer<NPObject> GPUPluginObject::OpenCommandBuffer() {
if (command_buffer_object_.Get())
return command_buffer_object_;
- NPObjectPointer<NPObject> window = NPObjectPointer<NPObject>::FromReturned(
- NPBrowser::get()->GetWindowNPObject(npp()));
- if (!window.Get())
- return NPObjectPointer<NPObject>();
-
- NPObjectPointer<NPObject> chromium;
- if (!NPGetProperty(npp(), window, "chromium", &chromium)) {
- return NPObjectPointer<NPObject>();
- }
-
- NPObjectPointer<NPObject> system;
- if (!NPGetProperty(npp(), chromium, "system", &system)) {
- return NPObjectPointer<NPObject>();
- }
-
- if (!NPInvoke(npp(), system, "createSharedMemory", kCommandBufferSize,
- &command_buffer_object_)) {
- return NPObjectPointer<NPObject>();
- }
-
- shared_memory_ = NPBrowser::get()->MapSharedMemory(
- npp(), command_buffer_object_.Get(), 1024, false);
- if (!shared_memory_) {
- command_buffer_object_ = NPObjectPointer<NPObject>();
- return NPObjectPointer<NPObject>();
+ command_buffer_object_ = NPCreateObject<CommandBuffer>(npp());
+ if (!command_buffer_object_->Initialize(kCommandBufferSize)) {
+ command_buffer_object_ = NPObjectPointer<CommandBuffer>();
}
return command_buffer_object_;