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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (last_state_.error == gpu::error::kNoError) { | 179 if (last_state_.error == gpu::error::kNoError) { |
179 gpu::CommandBuffer::State state; | 180 gpu::CommandBuffer::State state; |
180 if (Send(new PpapiHostMsg_PPBContext3D_GetState( | 181 if (Send(new PpapiHostMsg_PPBContext3D_GetState( |
181 INTERFACE_ID_PPB_CONTEXT_3D, resource_, &state))) | 182 INTERFACE_ID_PPB_CONTEXT_3D, resource_, &state))) |
182 UpdateState(state); | 183 UpdateState(state); |
183 } | 184 } |
184 | 185 |
185 return last_state_; | 186 return last_state_; |
186 } | 187 } |
187 | 188 |
| 189 gpu::CommandBuffer::State PepperCommandBuffer::GetLastState() { |
| 190 return last_state_; |
| 191 } |
| 192 |
188 void PepperCommandBuffer::Flush(int32 put_offset) { | 193 void PepperCommandBuffer::Flush(int32 put_offset) { |
189 if (last_state_.error != gpu::error::kNoError) | 194 if (last_state_.error != gpu::error::kNoError) |
190 return; | 195 return; |
191 | 196 |
192 IPC::Message* message = new PpapiHostMsg_PPBContext3D_AsyncFlush( | 197 IPC::Message* message = new PpapiHostMsg_PPBContext3D_AsyncFlush( |
193 INTERFACE_ID_PPB_CONTEXT_3D, resource_, put_offset); | 198 INTERFACE_ID_PPB_CONTEXT_3D, resource_, put_offset); |
194 | 199 |
195 // Do not let a synchronous flush hold up this message. If this handler is | 200 // Do not let a synchronous flush hold up this message. If this handler is |
196 // deferred until after the synchronous flush completes, it will overwrite the | 201 // deferred until after the synchronous flush completes, it will overwrite the |
197 // cached last_state_ with out-of-date data. | 202 // cached last_state_ with out-of-date data. |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 uint32_t shm_size = 0; | 709 uint32_t shm_size = 0; |
705 if (enter.succeeded() && | 710 if (enter.succeeded() && |
706 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { | 711 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { |
707 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); | 712 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); |
708 *size = shm_size; | 713 *size = shm_size; |
709 } | 714 } |
710 } | 715 } |
711 | 716 |
712 } // namespace proxy | 717 } // namespace proxy |
713 } // namespace pp | 718 } // namespace pp |
OLD | NEW |