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(); |
90 virtual void Flush(int32 put_offset); | 91 virtual void Flush(int32 put_offset); |
91 virtual State FlushSync(int32 put_offset, int32 last_known_get); | 92 virtual State FlushSync(int32 put_offset, int32 last_known_get); |
92 virtual void SetGetOffset(int32 get_offset); | 93 virtual void SetGetOffset(int32 get_offset); |
93 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); | 94 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); |
94 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, | 95 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, |
95 size_t size, | 96 size_t size, |
96 int32 id_request); | 97 int32 id_request); |
97 virtual void DestroyTransferBuffer(int32 id); | 98 virtual void DestroyTransferBuffer(int32 id); |
98 virtual gpu::Buffer GetTransferBuffer(int32 handle); | 99 virtual gpu::Buffer GetTransferBuffer(int32 handle); |
99 virtual void SetToken(int32 token); | 100 virtual void SetToken(int32 token); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 if (last_state_.error == gpu::error::kNoError) { | 180 if (last_state_.error == gpu::error::kNoError) { |
180 gpu::CommandBuffer::State state; | 181 gpu::CommandBuffer::State state; |
181 if (Send(new PpapiHostMsg_PPBContext3D_GetState( | 182 if (Send(new PpapiHostMsg_PPBContext3D_GetState( |
182 INTERFACE_ID_PPB_CONTEXT_3D, resource_, &state))) | 183 INTERFACE_ID_PPB_CONTEXT_3D, resource_, &state))) |
183 UpdateState(state); | 184 UpdateState(state); |
184 } | 185 } |
185 | 186 |
186 return last_state_; | 187 return last_state_; |
187 } | 188 } |
188 | 189 |
| 190 gpu::CommandBuffer::State PepperCommandBuffer::GetLastState() { |
| 191 return last_state_; |
| 192 } |
| 193 |
189 void PepperCommandBuffer::Flush(int32 put_offset) { | 194 void PepperCommandBuffer::Flush(int32 put_offset) { |
190 if (last_state_.error != gpu::error::kNoError) | 195 if (last_state_.error != gpu::error::kNoError) |
191 return; | 196 return; |
192 | 197 |
193 IPC::Message* message = new PpapiHostMsg_PPBContext3D_AsyncFlush( | 198 IPC::Message* message = new PpapiHostMsg_PPBContext3D_AsyncFlush( |
194 INTERFACE_ID_PPB_CONTEXT_3D, resource_, put_offset); | 199 INTERFACE_ID_PPB_CONTEXT_3D, resource_, put_offset); |
195 | 200 |
196 // Do not let a synchronous flush hold up this message. If this handler is | 201 // Do not let a synchronous flush hold up this message. If this handler is |
197 // deferred until after the synchronous flush completes, it will overwrite the | 202 // deferred until after the synchronous flush completes, it will overwrite the |
198 // cached last_state_ with out-of-date data. | 203 // cached last_state_ with out-of-date data. |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 uint32_t shm_size = 0; | 715 uint32_t shm_size = 0; |
711 if (enter.succeeded() && | 716 if (enter.succeeded() && |
712 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { | 717 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { |
713 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); | 718 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); |
714 *size = shm_size; | 719 *size = shm_size; |
715 } | 720 } |
716 } | 721 } |
717 | 722 |
718 } // namespace proxy | 723 } // namespace proxy |
719 } // namespace pp | 724 } // namespace pp |
OLD | NEW |