| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_ |
| 7 | 7 |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
| 11 #include "gpu/command_buffer/common/command_buffer.h" | 11 #include "gpu/command_buffer/common/command_buffer.h" |
| 12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 13 #include "gpu/command_buffer/service/cmd_parser.h" | 13 #include "gpu/command_buffer/service/cmd_parser.h" |
| 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 15 #include "gpu/np_utils/np_object_pointer.h" | |
| 16 | 15 |
| 17 namespace command_buffer { | 16 namespace command_buffer { |
| 18 | 17 |
| 19 // This class processes commands in a command buffer. It is event driven and | 18 // This class processes commands in a command buffer. It is event driven and |
| 20 // posts tasks to the current message loop to do additional work. | 19 // posts tasks to the current message loop to do additional work. |
| 21 class GPUProcessor : public ::base::RefCounted<GPUProcessor>, | 20 class GPUProcessor : public ::base::RefCounted<GPUProcessor>, |
| 22 public command_buffer::CommandBufferEngine { | 21 public command_buffer::CommandBufferEngine { |
| 23 public: | 22 public: |
| 24 GPUProcessor(NPP npp, CommandBuffer* command_buffer); | 23 explicit GPUProcessor(CommandBuffer* command_buffer); |
| 25 | 24 |
| 26 // This constructor is for unit tests. | 25 // This constructor is for unit tests. |
| 27 GPUProcessor(CommandBuffer* command_buffer, | 26 GPUProcessor(CommandBuffer* command_buffer, |
| 28 gles2::GLES2Decoder* decoder, | 27 gles2::GLES2Decoder* decoder, |
| 29 CommandParser* parser, | 28 CommandParser* parser, |
| 30 int commands_per_update); | 29 int commands_per_update); |
| 31 | 30 |
| 32 virtual bool Initialize(HWND hwnd); | 31 virtual bool Initialize(HWND hwnd); |
| 33 | 32 |
| 34 virtual ~GPUProcessor(); | 33 virtual ~GPUProcessor(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 | 49 |
| 51 // Gets the size of a registered shared memory buffer. | 50 // Gets the size of a registered shared memory buffer. |
| 52 // Parameters: | 51 // Parameters: |
| 53 // shm_id: the identifier for the shared memory buffer. | 52 // shm_id: the identifier for the shared memory buffer. |
| 54 virtual size_t GetSharedMemorySize(int32 shm_id); | 53 virtual size_t GetSharedMemorySize(int32 shm_id); |
| 55 | 54 |
| 56 // Sets the token value. | 55 // Sets the token value. |
| 57 virtual void set_token(int32 token); | 56 virtual void set_token(int32 token); |
| 58 | 57 |
| 59 private: | 58 private: |
| 60 NPP npp_; | |
| 61 | |
| 62 // The GPUProcessor holds a weak reference to the CommandBuffer. The | 59 // The GPUProcessor holds a weak reference to the CommandBuffer. The |
| 63 // CommandBuffer owns the GPUProcessor and holds a strong reference to it | 60 // CommandBuffer owns the GPUProcessor and holds a strong reference to it |
| 64 // through the ProcessCommands callback. | 61 // through the ProcessCommands callback. |
| 65 CommandBuffer* command_buffer_; | 62 CommandBuffer* command_buffer_; |
| 66 | 63 |
| 67 scoped_ptr< ::base::SharedMemory> mapped_ring_buffer_; | 64 scoped_ptr< ::base::SharedMemory> mapped_ring_buffer_; |
| 68 int commands_per_update_; | 65 int commands_per_update_; |
| 69 | 66 |
| 70 scoped_ptr<gles2::GLES2Decoder> decoder_; | 67 scoped_ptr<gles2::GLES2Decoder> decoder_; |
| 71 scoped_ptr<CommandParser> parser_; | 68 scoped_ptr<CommandParser> parser_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 90 | 87 |
| 91 protected: | 88 protected: |
| 92 command_buffer::GPUProcessor* obj_; | 89 command_buffer::GPUProcessor* obj_; |
| 93 Method meth_; | 90 Method meth_; |
| 94 | 91 |
| 95 private: | 92 private: |
| 96 DISALLOW_COPY_AND_ASSIGN(CallbackStorage); | 93 DISALLOW_COPY_AND_ASSIGN(CallbackStorage); |
| 97 }; | 94 }; |
| 98 | 95 |
| 99 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_ | 96 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_ |
| OLD | NEW |