| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/hash.h" | 8 #include "base/hash.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 void RunOnThread(scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 155 void RunOnThread(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 156 const base::Closure& callback) { | 156 const base::Closure& callback) { |
| 157 if (task_runner->BelongsToCurrentThread()) { | 157 if (task_runner->BelongsToCurrentThread()) { |
| 158 callback.Run(); | 158 callback.Run(); |
| 159 } else { | 159 } else { |
| 160 task_runner->PostTask(FROM_HERE, callback); | 160 task_runner->PostTask(FROM_HERE, callback); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 uint64_t GetCommandBufferID(int channel_id, int32 route_id) { |
| 165 return (static_cast<uint64_t>(channel_id) << 32) | route_id; |
| 166 } |
| 167 |
| 164 } // namespace | 168 } // namespace |
| 165 | 169 |
| 166 GpuCommandBufferStub::GpuCommandBufferStub( | 170 GpuCommandBufferStub::GpuCommandBufferStub( |
| 167 GpuChannel* channel, | 171 GpuChannel* channel, |
| 168 base::SingleThreadTaskRunner* task_runner, | 172 base::SingleThreadTaskRunner* task_runner, |
| 169 GpuCommandBufferStub* share_group, | 173 GpuCommandBufferStub* share_group, |
| 170 const gfx::GLSurfaceHandle& handle, | 174 const gfx::GLSurfaceHandle& handle, |
| 171 gpu::gles2::MailboxManager* mailbox_manager, | 175 gpu::gles2::MailboxManager* mailbox_manager, |
| 172 gpu::gles2::SubscriptionRefSet* subscription_ref_set, | 176 gpu::gles2::SubscriptionRefSet* subscription_ref_set, |
| 173 gpu::ValueStateMap* pending_valuebuffer_state, | 177 gpu::ValueStateMap* pending_valuebuffer_state, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 184 const GURL& active_url) | 188 const GURL& active_url) |
| 185 : channel_(channel), | 189 : channel_(channel), |
| 186 task_runner_(task_runner), | 190 task_runner_(task_runner), |
| 187 initialized_(false), | 191 initialized_(false), |
| 188 handle_(handle), | 192 handle_(handle), |
| 189 initial_size_(size), | 193 initial_size_(size), |
| 190 disallowed_features_(disallowed_features), | 194 disallowed_features_(disallowed_features), |
| 191 requested_attribs_(attribs), | 195 requested_attribs_(attribs), |
| 192 gpu_preference_(gpu_preference), | 196 gpu_preference_(gpu_preference), |
| 193 use_virtualized_gl_context_(use_virtualized_gl_context), | 197 use_virtualized_gl_context_(use_virtualized_gl_context), |
| 198 command_buffer_id_(GetCommandBufferID(channel->client_id(), route_id)), |
| 194 stream_id_(stream_id), | 199 stream_id_(stream_id), |
| 195 route_id_(route_id), | 200 route_id_(route_id), |
| 196 surface_id_(surface_id), | 201 surface_id_(surface_id), |
| 197 software_(software), | 202 software_(software), |
| 198 last_flush_count_(0), | 203 last_flush_count_(0), |
| 199 last_memory_allocation_valid_(false), | 204 last_memory_allocation_valid_(false), |
| 200 watchdog_(watchdog), | 205 watchdog_(watchdog), |
| 201 sync_point_wait_count_(0), | 206 sync_point_wait_count_(0), |
| 202 previous_processed_num_(0), | 207 previous_processed_num_(0), |
| 203 active_url_(active_url), | 208 active_url_(active_url), |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 result)); | 1208 result)); |
| 1204 } | 1209 } |
| 1205 | 1210 |
| 1206 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1211 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1207 base::TimeDelta interval) { | 1212 base::TimeDelta interval) { |
| 1208 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1213 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1209 interval)); | 1214 interval)); |
| 1210 } | 1215 } |
| 1211 | 1216 |
| 1212 } // namespace content | 1217 } // namespace content |
| OLD | NEW |