OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ppapi/proxy/ppb_context_3d_proxy.h" | 5 #include "ppapi/proxy/ppb_context_3d_proxy.h" |
6 | 6 |
7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 public: | 80 public: |
81 PepperCommandBuffer(const HostResource& resource, | 81 PepperCommandBuffer(const HostResource& resource, |
82 PluginDispatcher* dispatcher); | 82 PluginDispatcher* dispatcher); |
83 virtual ~PepperCommandBuffer(); | 83 virtual ~PepperCommandBuffer(); |
84 | 84 |
85 // CommandBuffer implementation: | 85 // CommandBuffer implementation: |
86 virtual bool Initialize(int32 size); | 86 virtual bool Initialize(int32 size); |
87 virtual bool Initialize(base::SharedMemory* buffer, int32 size); | 87 virtual bool Initialize(base::SharedMemory* buffer, int32 size); |
88 virtual gpu::Buffer GetRingBuffer(); | 88 virtual gpu::Buffer GetRingBuffer(); |
89 virtual State GetState(); | 89 virtual State GetState(); |
90 virtual State GetLastState(); | |
91 virtual void Flush(int32 put_offset); | 90 virtual void Flush(int32 put_offset); |
92 virtual State FlushSync(int32 put_offset, int32 last_known_get); | 91 virtual State FlushSync(int32 put_offset, int32 last_known_get); |
93 virtual void SetGetOffset(int32 get_offset); | 92 virtual void SetGetOffset(int32 get_offset); |
94 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); | 93 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); |
95 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, | 94 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, |
96 size_t size, | 95 size_t size, |
97 int32 id_request); | 96 int32 id_request); |
98 virtual void DestroyTransferBuffer(int32 id); | 97 virtual void DestroyTransferBuffer(int32 id); |
99 virtual gpu::Buffer GetTransferBuffer(int32 handle); | 98 virtual gpu::Buffer GetTransferBuffer(int32 handle); |
100 virtual void SetToken(int32 token); | 99 virtual void SetToken(int32 token); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 if (last_state_.error == gpu::error::kNoError) { | 179 if (last_state_.error == gpu::error::kNoError) { |
181 gpu::CommandBuffer::State state; | 180 gpu::CommandBuffer::State state; |
182 if (Send(new PpapiHostMsg_PPBContext3D_GetState( | 181 if (Send(new PpapiHostMsg_PPBContext3D_GetState( |
183 INTERFACE_ID_PPB_CONTEXT_3D, resource_, &state))) | 182 INTERFACE_ID_PPB_CONTEXT_3D, resource_, &state))) |
184 UpdateState(state); | 183 UpdateState(state); |
185 } | 184 } |
186 | 185 |
187 return last_state_; | 186 return last_state_; |
188 } | 187 } |
189 | 188 |
190 gpu::CommandBuffer::State PepperCommandBuffer::GetLastState() { | |
191 return last_state_; | |
192 } | |
193 | |
194 void PepperCommandBuffer::Flush(int32 put_offset) { | 189 void PepperCommandBuffer::Flush(int32 put_offset) { |
195 if (last_state_.error != gpu::error::kNoError) | 190 if (last_state_.error != gpu::error::kNoError) |
196 return; | 191 return; |
197 | 192 |
198 IPC::Message* message = new PpapiHostMsg_PPBContext3D_AsyncFlush( | 193 IPC::Message* message = new PpapiHostMsg_PPBContext3D_AsyncFlush( |
199 INTERFACE_ID_PPB_CONTEXT_3D, resource_, put_offset); | 194 INTERFACE_ID_PPB_CONTEXT_3D, resource_, put_offset); |
200 | 195 |
201 // Do not let a synchronous flush hold up this message. If this handler is | 196 // Do not let a synchronous flush hold up this message. If this handler is |
202 // deferred until after the synchronous flush completes, it will overwrite the | 197 // deferred until after the synchronous flush completes, it will overwrite the |
203 // cached last_state_ with out-of-date data. | 198 // cached last_state_ with out-of-date data. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 uint32_t shm_size = 0; | 714 uint32_t shm_size = 0; |
720 if (enter.succeeded() && | 715 if (enter.succeeded() && |
721 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { | 716 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { |
722 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); | 717 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); |
723 *size = shm_size; | 718 *size = shm_size; |
724 } | 719 } |
725 } | 720 } |
726 | 721 |
727 } // namespace proxy | 722 } // namespace proxy |
728 } // namespace pp | 723 } // namespace pp |
OLD | NEW |