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

Side by Side Diff: gpu/command_buffer/service/command_buffer_service.cc

Issue 6316002: Make CommandBuffer::Flush asynchronous, and add CommandBuffer::FlushSync with former semantics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 11 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
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/pgl/command_buffer_pepper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "gpu/command_buffer/service/command_buffer_service.h" 5 #include "gpu/command_buffer/service/command_buffer_service.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "gpu/command_buffer/common/cmd_buffer_common.h" 10 #include "gpu/command_buffer/common/cmd_buffer_common.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 State state; 70 State state;
71 state.num_entries = num_entries_; 71 state.num_entries = num_entries_;
72 state.get_offset = get_offset_; 72 state.get_offset = get_offset_;
73 state.put_offset = put_offset_; 73 state.put_offset = put_offset_;
74 state.token = token_; 74 state.token = token_;
75 state.error = error_; 75 state.error = error_;
76 76
77 return state; 77 return state;
78 } 78 }
79 79
80 CommandBufferService::State CommandBufferService::Flush(int32 put_offset) { 80 CommandBufferService::State CommandBufferService::FlushSync(int32 put_offset) {
81 if (put_offset < 0 || put_offset > num_entries_) { 81 if (put_offset < 0 || put_offset > num_entries_) {
82 error_ = gpu::error::kOutOfBounds; 82 error_ = gpu::error::kOutOfBounds;
83 return GetState(); 83 return GetState();
84 } 84 }
85 85
86 put_offset_ = put_offset; 86 put_offset_ = put_offset;
87 87
88 if (put_offset_change_callback_.get()) { 88 if (put_offset_change_callback_.get()) {
89 put_offset_change_callback_->Run(); 89 put_offset_change_callback_->Run();
90 } 90 }
91 91
92 return GetState(); 92 return GetState();
93 } 93 }
94 94
95 void CommandBufferService::Flush(int32 put_offset) {
96 FlushSync(put_offset);
97 }
98
95 void CommandBufferService::SetGetOffset(int32 get_offset) { 99 void CommandBufferService::SetGetOffset(int32 get_offset) {
96 DCHECK(get_offset >= 0 && get_offset < num_entries_); 100 DCHECK(get_offset >= 0 && get_offset < num_entries_);
97 get_offset_ = get_offset; 101 get_offset_ = get_offset;
98 } 102 }
99 103
100 int32 CommandBufferService::CreateTransferBuffer(size_t size) { 104 int32 CommandBufferService::CreateTransferBuffer(size_t size) {
101 linked_ptr<SharedMemory> buffer(new SharedMemory); 105 linked_ptr<SharedMemory> buffer(new SharedMemory);
102 if (!buffer->CreateAnonymous(size)) 106 if (!buffer->CreateAnonymous(size))
103 return -1; 107 return -1;
104 108
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 error_ = error; 176 error_ = error;
173 } 177 }
174 } 178 }
175 179
176 void CommandBufferService::SetPutOffsetChangeCallback( 180 void CommandBufferService::SetPutOffsetChangeCallback(
177 Callback0::Type* callback) { 181 Callback0::Type* callback) {
178 put_offset_change_callback_.reset(callback); 182 put_offset_change_callback_.reset(callback);
179 } 183 }
180 184
181 } // namespace gpu 185 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/pgl/command_buffer_pepper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698