Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: content/renderer/command_buffer_proxy.cc

Issue 6862002: Merge gpu_trace_event back into base/debug/trace_event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to 84062 Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/renderer/command_buffer_proxy.h" 5 #include "content/renderer/command_buffer_proxy.h"
6 6
7 #include "base/debug/trace_event.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/process_util.h" 9 #include "base/process_util.h"
9 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
10 #include "base/task.h" 11 #include "base/task.h"
11 #include "content/common/gpu/gpu_messages.h" 12 #include "content/common/gpu/gpu_messages.h"
12 #include "content/common/plugin_messages.h" 13 #include "content/common/plugin_messages.h"
13 #include "content/common/view_messages.h" 14 #include "content/common/view_messages.h"
14 #include "content/renderer/plugin_channel_host.h" 15 #include "content/renderer/plugin_channel_host.h"
15 #include "content/renderer/render_thread.h" 16 #include "content/renderer/render_thread.h"
16 #include "gpu/command_buffer/common/cmd_buffer_common.h" 17 #include "gpu/command_buffer/common/cmd_buffer_common.h"
17 #include "gpu/common/gpu_trace_event.h"
18 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
19 19
20 using gpu::Buffer; 20 using gpu::Buffer;
21 21
22 CommandBufferProxy::CommandBufferProxy( 22 CommandBufferProxy::CommandBufferProxy(
23 IPC::Channel::Sender* channel, 23 IPC::Channel::Sender* channel,
24 int route_id) 24 int route_id)
25 : num_entries_(0), 25 : num_entries_(0),
26 channel_(channel), 26 channel_(channel),
27 route_id_(route_id) { 27 route_id_(route_id) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 void CommandBufferProxy::Flush(int32 put_offset) { 152 void CommandBufferProxy::Flush(int32 put_offset) {
153 if (last_state_.error != gpu::error::kNoError) 153 if (last_state_.error != gpu::error::kNoError)
154 return; 154 return;
155 155
156 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, put_offset)); 156 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, put_offset));
157 } 157 }
158 158
159 gpu::CommandBuffer::State CommandBufferProxy::FlushSync(int32 put_offset, 159 gpu::CommandBuffer::State CommandBufferProxy::FlushSync(int32 put_offset,
160 int32 last_known_get) { 160 int32 last_known_get) {
161 GPU_TRACE_EVENT0("gpu", "CommandBufferProxy::FlushSync"); 161 TRACE_EVENT0("gpu", "CommandBufferProxy::FlushSync");
162 if (last_known_get == last_state_.get_offset) { 162 if (last_known_get == last_state_.get_offset) {
163 // Send will flag state with lost context if IPC fails. 163 // Send will flag state with lost context if IPC fails.
164 if (last_state_.error == gpu::error::kNoError) { 164 if (last_state_.error == gpu::error::kNoError) {
165 gpu::CommandBuffer::State state; 165 gpu::CommandBuffer::State state;
166 if (Send(new GpuCommandBufferMsg_Flush(route_id_, 166 if (Send(new GpuCommandBufferMsg_Flush(route_id_,
167 put_offset, 167 put_offset,
168 last_known_get, 168 last_known_get,
169 &state))) 169 &state)))
170 OnUpdateState(state); 170 OnUpdateState(state);
171 } 171 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 delete msg; 380 delete msg;
381 return false; 381 return false;
382 } 382 }
383 383
384 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { 384 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) {
385 // Handle wraparound. It works as long as we don't have more than 2B state 385 // Handle wraparound. It works as long as we don't have more than 2B state
386 // updates in flight across which reordering occurs. 386 // updates in flight across which reordering occurs.
387 if (state.generation - last_state_.generation < 0x80000000U) 387 if (state.generation - last_state_.generation < 0x80000000U)
388 last_state_ = state; 388 last_state_ = state;
389 } 389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698