OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
7 #include "chrome/common/command_buffer_messages.h" | 7 #include "chrome/common/command_buffer_messages.h" |
8 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.h" |
9 #include "chrome/renderer/command_buffer_proxy.h" | 9 #include "chrome/renderer/command_buffer_proxy.h" |
10 #include "chrome/renderer/plugin_channel_host.h" | 10 #include "chrome/renderer/plugin_channel_host.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 Buffer CommandBufferProxy::GetRingBuffer() { | 65 Buffer CommandBufferProxy::GetRingBuffer() { |
66 // Return locally cached ring buffer. | 66 // Return locally cached ring buffer. |
67 Buffer buffer; | 67 Buffer buffer; |
68 buffer.ptr = ring_buffer_->memory(); | 68 buffer.ptr = ring_buffer_->memory(); |
69 buffer.size = size_ * sizeof(gpu::CommandBufferEntry); | 69 buffer.size = size_ * sizeof(gpu::CommandBufferEntry); |
70 buffer.shared_memory = ring_buffer_.get(); | 70 buffer.shared_memory = ring_buffer_.get(); |
71 return buffer; | 71 return buffer; |
72 } | 72 } |
73 | 73 |
74 int32 CommandBufferProxy::GetSize() { | 74 gpu::CommandBuffer::State CommandBufferProxy::GetState() { |
75 // Return locally cached size. | 75 gpu::CommandBuffer::State state; |
76 return size_; | 76 Send(new CommandBufferMsg_GetState(route_id_, &state)); |
| 77 return state; |
77 } | 78 } |
78 | 79 |
79 int32 CommandBufferProxy::SyncOffsets(int32 put_offset) { | 80 gpu::CommandBuffer::State CommandBufferProxy::Flush(int32 put_offset) { |
80 int32 get_offset; | 81 gpu::CommandBuffer::State state; |
81 if (Send(new CommandBufferMsg_SyncOffsets(route_id_, | 82 Send(new CommandBufferMsg_Flush(route_id_, |
82 put_offset, | 83 put_offset, |
83 &get_offset))) | 84 &state)); |
84 return get_offset; | 85 return state; |
85 | |
86 return -1; | |
87 } | |
88 | |
89 int32 CommandBufferProxy::GetGetOffset() { | |
90 int32 get_offset; | |
91 if (Send(new CommandBufferMsg_GetGetOffset(route_id_, &get_offset))) | |
92 return get_offset; | |
93 | |
94 return -1; | |
95 } | 86 } |
96 | 87 |
97 void CommandBufferProxy::SetGetOffset(int32 get_offset) { | 88 void CommandBufferProxy::SetGetOffset(int32 get_offset) { |
98 // Not implemented in proxy. | 89 // Not implemented in proxy. |
99 NOTREACHED(); | 90 NOTREACHED(); |
100 } | 91 } |
101 | 92 |
102 int32 CommandBufferProxy::GetPutOffset() { | |
103 int put_offset; | |
104 if (Send(new CommandBufferMsg_GetPutOffset(route_id_, &put_offset))) | |
105 return put_offset; | |
106 | |
107 return -1; | |
108 } | |
109 | |
110 int32 CommandBufferProxy::CreateTransferBuffer(size_t size) { | 93 int32 CommandBufferProxy::CreateTransferBuffer(size_t size) { |
111 int32 id; | 94 int32 id; |
112 if (Send(new CommandBufferMsg_CreateTransferBuffer(route_id_, size, &id))) | 95 if (Send(new CommandBufferMsg_CreateTransferBuffer(route_id_, size, &id))) |
113 return id; | 96 return id; |
114 | 97 |
115 return -1; | 98 return -1; |
116 } | 99 } |
117 | 100 |
118 void CommandBufferProxy::DestroyTransferBuffer(int32 id) { | 101 void CommandBufferProxy::DestroyTransferBuffer(int32 id) { |
119 // Remove the transfer buffer from the client side4 cache. | 102 // Remove the transfer buffer from the client side4 cache. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 152 |
170 Buffer buffer; | 153 Buffer buffer; |
171 buffer.ptr = shared_memory->memory(); | 154 buffer.ptr = shared_memory->memory(); |
172 buffer.size = size; | 155 buffer.size = size; |
173 buffer.shared_memory = shared_memory; | 156 buffer.shared_memory = shared_memory; |
174 transfer_buffers_[id] = buffer; | 157 transfer_buffers_[id] = buffer; |
175 | 158 |
176 return buffer; | 159 return buffer; |
177 } | 160 } |
178 | 161 |
179 int32 CommandBufferProxy::GetToken() { | |
180 int32 token; | |
181 if (Send(new CommandBufferMsg_GetToken(route_id_, &token))) | |
182 return token; | |
183 | |
184 return -1; | |
185 } | |
186 | |
187 void CommandBufferProxy::SetToken(int32 token) { | 162 void CommandBufferProxy::SetToken(int32 token) { |
188 // Not implemented in proxy. | 163 // Not implemented in proxy. |
189 NOTREACHED(); | 164 NOTREACHED(); |
190 } | 165 } |
191 | 166 |
192 int32 CommandBufferProxy::ResetParseError() { | 167 void CommandBufferProxy::SetParseError( |
193 int32 parse_error; | 168 gpu::parse_error::ParseError parse_error) { |
194 if (Send(new CommandBufferMsg_ResetParseError(route_id_, &parse_error))) | |
195 return parse_error; | |
196 | |
197 return -1; | |
198 } | |
199 | |
200 void CommandBufferProxy::SetParseError(int32 parse_error) { | |
201 // Not implemented in proxy. | 169 // Not implemented in proxy. |
202 NOTREACHED(); | 170 NOTREACHED(); |
203 } | 171 } |
204 | |
205 bool CommandBufferProxy::GetErrorStatus() { | |
206 bool status; | |
207 if (Send(new CommandBufferMsg_GetErrorStatus(route_id_, &status))) | |
208 return status; | |
209 | |
210 return true; | |
211 } | |
212 | |
213 void CommandBufferProxy::RaiseErrorStatus() { | |
214 // Not implemented in proxy. | |
215 NOTREACHED(); | |
216 } | |
OLD | NEW |