diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-16 23:24:41 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-16 23:24:41 +0000 |
commit | ba1d6b0893d6d07cf1fb924f4212446d4e6136d4 (patch) | |
tree | 1a614a02f797a7e172a72c99857debbd9706d28f /o3d/core | |
parent | 8ca3290c9c7bc8dfff4520562290363c71cf0235 (diff) | |
download | chromium_src-ba1d6b0893d6d07cf1fb924f4212446d4e6136d4.zip chromium_src-ba1d6b0893d6d07cf1fb924f4212446d4e6136d4.tar.gz chromium_src-ba1d6b0893d6d07cf1fb924f4212446d4e6136d4.tar.bz2 |
Renamed CommandBuffer to CommandBufferServer and extracted CommandBuffer interface.
Moved np_utils classes into new np_utils namespace.
Removed some of the command_buffer dependencies on NPAPI.
CommandBuffer(Server) is no longer an NPObject.
Review URL: http://codereview.chromium.org/387063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r-- | o3d/core/core.gyp | 4 | ||||
-rw-r--r-- | o3d/core/cross/command_buffer/display_window_cb.h | 23 | ||||
-rw-r--r-- | o3d/core/cross/command_buffer/renderer_cb.cc | 56 | ||||
-rw-r--r-- | o3d/core/cross/command_buffer/renderer_cb.h | 9 |
4 files changed, 36 insertions, 56 deletions
diff --git a/o3d/core/core.gyp b/o3d/core/core.gyp index 1f3afa8..11b4d33 100644 --- a/o3d/core/core.gyp +++ b/o3d/core/core.gyp @@ -431,10 +431,6 @@ { 'dependencies': [ '../gpu/gpu.gyp:command_buffer_service', - - # These dependencies are only needed for RendererCBLocal. They can - # be removed when RendererCBLocal is not needed. - '../gpu/gpu.gyp:command_buffer', ], }, ], diff --git a/o3d/core/cross/command_buffer/display_window_cb.h b/o3d/core/cross/command_buffer/display_window_cb.h index 74486bf..a855457 100644 --- a/o3d/core/cross/command_buffer/display_window_cb.h +++ b/o3d/core/cross/command_buffer/display_window_cb.h @@ -34,8 +34,7 @@ #define O3D_CORE_WIN_DISPLAY_WINDOW_CB_H_ #include "core/cross/display_window.h" -#include "gpu/gpu_plugin/command_buffer.h" -#include "gpu/np_utils/np_object_pointer.h" +#include "gpu/command_buffer/common/command_buffer.h" namespace o3d { @@ -43,25 +42,14 @@ namespace o3d { // an out-of-process command buffer renderer. class DisplayWindowCB : public DisplayWindow { public: - DisplayWindowCB() : npp_(NULL), width_(0), height_(0) {} + DisplayWindowCB() : width_(0), height_(0) {} virtual ~DisplayWindowCB() {} - NPP npp() const { - return npp_; - } - - void set_npp(NPP npp) { - npp_ = npp; - } - - gpu_plugin::NPObjectPointer<gpu_plugin::CommandBuffer> - command_buffer() const { + command_buffer::CommandBuffer* command_buffer() const { return command_buffer_; } - void set_command_buffer( - const gpu_plugin::NPObjectPointer<gpu_plugin::CommandBuffer> - command_buffer) { + void set_command_buffer(command_buffer::CommandBuffer* command_buffer) { command_buffer_ = command_buffer; } @@ -82,8 +70,7 @@ class DisplayWindowCB : public DisplayWindow { } private: - NPP npp_; - gpu_plugin::NPObjectPointer<gpu_plugin::CommandBuffer> command_buffer_; + command_buffer::CommandBuffer* command_buffer_; int width_; int height_; DISALLOW_COPY_AND_ASSIGN(DisplayWindowCB); diff --git a/o3d/core/cross/command_buffer/renderer_cb.cc b/o3d/core/cross/command_buffer/renderer_cb.cc index a6a07d8..3ea8db5 100644 --- a/o3d/core/cross/command_buffer/renderer_cb.cc +++ b/o3d/core/cross/command_buffer/renderer_cb.cc @@ -49,29 +49,26 @@ #include "core/cross/command_buffer/texture_cb.h" #include "core/cross/command_buffer/display_window_cb.h" #include "core/cross/renderer_platform.h" -#include "gpu/gpu_plugin/command_buffer.h" -#include "gpu/gpu_plugin/gpu_processor.h" +#include "gpu/command_buffer/service/command_buffer_service.h" +#include "gpu/command_buffer/service/gpu_processor.h" #include "gpu/np_utils/np_browser.h" #include "gpu/np_utils/np_utils.h" -#if !defined(CB_SERVICE_REMOTE) -#include "gpu/gpu_plugin/gpu_processor.h" -#endif - namespace o3d { using ::base::SharedMemory; +using ::command_buffer::CommandBufferService; using command_buffer::o3d::GAPIInterface; using command_buffer::O3DCmdHelper; -using gpu_plugin::NPBrowser; -using gpu_plugin::NPCreateObject; -using gpu_plugin::NPGetProperty; -using gpu_plugin::NPInvoke; -using gpu_plugin::NPInvokeVoid; -using gpu_plugin::NPObjectPointer; +using np_utils::NPBrowser; +using np_utils::NPCreateObject; +using np_utils::NPGetProperty; +using np_utils::NPInvoke; +using np_utils::NPInvokeVoid; +using np_utils::NPObjectPointer; #if !defined(CB_SERVICE_REMOTE) -using gpu_plugin::CommandBuffer; -using gpu_plugin::GPUProcessor; +using command_buffer::CommandBuffer; +using command_buffer::GPUProcessor; #endif RendererCB::RendererCB(ServiceLocator* service_locator, @@ -94,7 +91,7 @@ RendererCB::~RendererCB() { } void RendererCB::Destroy() { - if (command_buffer_.Get()) { + if (command_buffer_.get()) { command_buffer_->DestroyTransferBuffer(transfer_shm_id_); } @@ -294,12 +291,11 @@ Renderer::InitStatus RendererCB::InitPlatformSpecific( const DisplayWindowCB& display_platform = static_cast<const DisplayWindowCB&>(display_window); - npp_ = display_platform.npp(); - command_buffer_ = display_platform.command_buffer(); - DCHECK(command_buffer_.Get()); + command_buffer_.reset(display_platform.command_buffer()); + DCHECK(command_buffer_.get()); // Create and initialize a O3DCmdHelper. - helper_ = new O3DCmdHelper(npp_, command_buffer_); + helper_ = new O3DCmdHelper(command_buffer_.get()); if (!helper_->Initialize()) { Destroy(); return INITIALIZATION_ERROR; @@ -384,33 +380,33 @@ RendererCBLocal::RendererCBLocal(ServiceLocator* service_locator, RendererCBLocal::~RendererCBLocal() { } -NPObjectPointer<CommandBuffer> RendererCBLocal::CreateCommandBuffer( - NPP npp, void* hwnd, int32 size) { +CommandBuffer* RendererCBLocal::CreateCommandBuffer(NPP npp, + void* hwnd, + int32 size) { #if defined(OS_WIN) scoped_ptr<SharedMemory> ring_buffer(new SharedMemory); if (!ring_buffer->Create(std::wstring(), false, false, size)) - return NPObjectPointer<CommandBuffer>(); + return NULL; if (!ring_buffer->Map(size)) - return NPObjectPointer<CommandBuffer>(); + return NULL; - NPObjectPointer<CommandBuffer> command_buffer = - NPCreateObject<CommandBuffer>(npp); + scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService); if (!command_buffer->Initialize(ring_buffer.release())) - return NPObjectPointer<CommandBuffer>(); + return NULL; scoped_refptr<GPUProcessor> gpu_processor( - new GPUProcessor(npp, command_buffer.Get())); + new GPUProcessor(npp, command_buffer.get())); if (!gpu_processor->Initialize(reinterpret_cast<HWND>(hwnd))) - return NPObjectPointer<CommandBuffer>(); + return NULL; command_buffer->SetPutOffsetChangeCallback( NewCallback(gpu_processor.get(), &GPUProcessor::ProcessCommands)); - return command_buffer; + return command_buffer.release(); #else - return NPObjectPointer<CommandBuffer>(); + return NULL; #endif } diff --git a/o3d/core/cross/command_buffer/renderer_cb.h b/o3d/core/cross/command_buffer/renderer_cb.h index 9168bb5..56b1d17 100644 --- a/o3d/core/cross/command_buffer/renderer_cb.h +++ b/o3d/core/cross/command_buffer/renderer_cb.h @@ -39,11 +39,11 @@ #include "core/cross/precompile.h" #include <vector> #include "core/cross/renderer.h" +#include "gpu/command_buffer/common/command_buffer.h" #include "gpu/command_buffer/common/constants.h" #include "gpu/command_buffer/common/resource.h" #include "gpu/command_buffer/client/fenced_allocator.h" #include "gpu/command_buffer/client/id_allocator.h" -#include "gpu/gpu_plugin/command_buffer.h" #include "gpu/np_utils/np_object_pointer.h" namespace command_buffer { @@ -249,6 +249,7 @@ class RendererCB : public Renderer { protected: // Initializes the renderer for use, claiming hardware resources. + // Takes ownership of CommandBuffer. virtual InitStatus InitPlatformSpecific(const DisplayWindow& display_window, bool off_screen); @@ -258,7 +259,7 @@ class RendererCB : public Renderer { int32 transfer_shm_id_; void *transfer_shm_address_; NPP npp_; - gpu_plugin::NPObjectPointer<gpu_plugin::CommandBuffer> command_buffer_; + scoped_ptr<::command_buffer::CommandBuffer> command_buffer_; ::command_buffer::O3DCmdHelper *helper_; ::command_buffer::FencedAllocatorWrapper *allocator_; @@ -305,8 +306,8 @@ class RendererCBRemote : public RendererCB { // code in RendererCBRemote will be merged into RendererCB. class RendererCBLocal : public RendererCB { public: - static gpu_plugin::NPObjectPointer<gpu_plugin::CommandBuffer> - CreateCommandBuffer(NPP npp, void* hwnd, int32 size); + static ::command_buffer::CommandBuffer* CreateCommandBuffer( + NPP npp, void* hwnd, int32 size); // Creates a default RendererCBLocal. static RendererCBLocal *CreateDefault(ServiceLocator* service_locator); |