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

Side by Side Diff: gpu/command_buffer/client/cmd_buffer_helper.cc

Issue 6883179: Rework FlushSync to return early if commands have been processed since the last update (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style Created 9 years, 8 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 // This file contains the implementation of the command buffer helper class. 5 // This file contains the implementation of the command buffer helper class.
6 6
7 #include "../client/cmd_buffer_helper.h" 7 #include "../client/cmd_buffer_helper.h"
8 #include "../common/command_buffer.h" 8 #include "../common/command_buffer.h"
9 #include "gpu/common/gpu_trace_event.h" 9 #include "gpu/common/gpu_trace_event.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 put_ = state.put_offset; 42 put_ = state.put_offset;
43 SynchronizeState(state); 43 SynchronizeState(state);
44 return true; 44 return true;
45 } 45 }
46 46
47 CommandBufferHelper::~CommandBufferHelper() { 47 CommandBufferHelper::~CommandBufferHelper() {
48 } 48 }
49 49
50 bool CommandBufferHelper::FlushSync() { 50 bool CommandBufferHelper::FlushSync() {
51 last_put_sent_ = put_; 51 last_put_sent_ = put_;
52 CommandBuffer::State state = command_buffer_->FlushSync(put_); 52 CommandBuffer::State state = command_buffer_->FlushSync(put_, get_);
53 SynchronizeState(state); 53 SynchronizeState(state);
54 return state.error == error::kNoError; 54 return state.error == error::kNoError;
55 } 55 }
56 56
57 void CommandBufferHelper::Flush() { 57 void CommandBufferHelper::Flush() {
58 last_put_sent_ = put_; 58 last_put_sent_ = put_;
59 command_buffer_->Flush(put_); 59 command_buffer_->Flush(put_);
60 } 60 }
61 61
62 // Calls Flush() and then waits until the buffer is empty. Break early if the 62 // Calls Flush() and then waits until the buffer is empty. Break early if the
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 SynchronizeState(state); 179 SynchronizeState(state);
180 return static_cast<error::Error>(state.error); 180 return static_cast<error::Error>(state.error);
181 } 181 }
182 182
183 void CommandBufferHelper::SynchronizeState(CommandBuffer::State state) { 183 void CommandBufferHelper::SynchronizeState(CommandBuffer::State state) {
184 get_ = state.get_offset; 184 get_ = state.get_offset;
185 last_token_read_ = state.token; 185 last_token_read_ = state.token;
186 } 186 }
187 187
188 } // namespace gpu 188 } // namespace gpu
OLDNEW
« no previous file with comments | « content/renderer/command_buffer_proxy.cc ('k') | gpu/command_buffer/client/cmd_buffer_helper_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698