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

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

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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
OLDNEW
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 "gpu/command_buffer/service/gpu_scheduler.h" 5 #include "gpu/command_buffer/service/gpu_scheduler.h"
6 6
7 #include <stdint.h>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/command_line.h" 10 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
10 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
11 #include "base/time/time.h" 13 #include "base/time/time.h"
12 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
13 #include "gpu/command_buffer/service/logger.h" 15 #include "gpu/command_buffer/service/logger.h"
14 #include "ui/gl/gl_bindings.h" 16 #include "ui/gl/gl_bindings.h"
15 #include "ui/gl/gl_fence.h" 17 #include "ui/gl/gl_fence.h"
16 #include "ui/gl/gl_switches.h" 18 #include "ui/gl/gl_switches.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 error = parser_->ProcessCommands(CommandParser::kParseCommandsSlice); 62 error = parser_->ProcessCommands(CommandParser::kParseCommandsSlice);
61 63
62 if (error == error::kDeferCommandUntilLater) { 64 if (error == error::kDeferCommandUntilLater) {
63 DCHECK(!scheduled()); 65 DCHECK(!scheduled());
64 break; 66 break;
65 } 67 }
66 68
67 // TODO(piman): various classes duplicate various pieces of state, leading 69 // TODO(piman): various classes duplicate various pieces of state, leading
68 // to needlessly complex update logic. It should be possible to simply 70 // to needlessly complex update logic. It should be possible to simply
69 // share the state across all of them. 71 // share the state across all of them.
70 command_buffer_->SetGetOffset(static_cast<int32>(parser_->get())); 72 command_buffer_->SetGetOffset(static_cast<int32_t>(parser_->get()));
71 73
72 if (error::IsError(error)) { 74 if (error::IsError(error)) {
73 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); 75 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
74 command_buffer_->SetParseError(error); 76 command_buffer_->SetParseError(error);
75 break; 77 break;
76 } 78 }
77 79
78 if (!command_processed_callback_.is_null()) 80 if (!command_processed_callback_.is_null())
79 command_processed_callback_.Run(); 81 command_processed_callback_.Run();
80 82
(...skipping 29 matching lines...) Expand all
110 if (!decoder_) 112 if (!decoder_)
111 return; 113 return;
112 decoder_->ProcessPendingQueries(false); 114 decoder_->ProcessPendingQueries(false);
113 } 115 }
114 116
115 void GpuScheduler::SetSchedulingChangedCallback( 117 void GpuScheduler::SetSchedulingChangedCallback(
116 const SchedulingChangedCallback& callback) { 118 const SchedulingChangedCallback& callback) {
117 scheduling_changed_callback_ = callback; 119 scheduling_changed_callback_ = callback;
118 } 120 }
119 121
120 scoped_refptr<Buffer> GpuScheduler::GetSharedMemoryBuffer(int32 shm_id) { 122 scoped_refptr<Buffer> GpuScheduler::GetSharedMemoryBuffer(int32_t shm_id) {
121 return command_buffer_->GetTransferBuffer(shm_id); 123 return command_buffer_->GetTransferBuffer(shm_id);
122 } 124 }
123 125
124 void GpuScheduler::set_token(int32 token) { 126 void GpuScheduler::set_token(int32_t token) {
125 command_buffer_->SetToken(token); 127 command_buffer_->SetToken(token);
126 } 128 }
127 129
128 bool GpuScheduler::SetGetBuffer(int32 transfer_buffer_id) { 130 bool GpuScheduler::SetGetBuffer(int32_t transfer_buffer_id) {
129 scoped_refptr<Buffer> ring_buffer = 131 scoped_refptr<Buffer> ring_buffer =
130 command_buffer_->GetTransferBuffer(transfer_buffer_id); 132 command_buffer_->GetTransferBuffer(transfer_buffer_id);
131 if (!ring_buffer.get()) { 133 if (!ring_buffer.get()) {
132 return false; 134 return false;
133 } 135 }
134 136
135 if (!parser_.get()) { 137 if (!parser_.get()) {
136 parser_.reset(new CommandParser(handler_)); 138 parser_.reset(new CommandParser(handler_));
137 } 139 }
138 140
139 parser_->SetBuffer( 141 parser_->SetBuffer(
140 ring_buffer->memory(), ring_buffer->size(), 0, ring_buffer->size()); 142 ring_buffer->memory(), ring_buffer->size(), 0, ring_buffer->size());
141 143
142 SetGetOffset(0); 144 SetGetOffset(0);
143 return true; 145 return true;
144 } 146 }
145 147
146 bool GpuScheduler::SetGetOffset(int32 offset) { 148 bool GpuScheduler::SetGetOffset(int32_t offset) {
147 if (parser_->set_get(offset)) { 149 if (parser_->set_get(offset)) {
148 command_buffer_->SetGetOffset(static_cast<int32>(parser_->get())); 150 command_buffer_->SetGetOffset(static_cast<int32_t>(parser_->get()));
149 return true; 151 return true;
150 } 152 }
151 return false; 153 return false;
152 } 154 }
153 155
154 int32 GpuScheduler::GetGetOffset() { 156 int32_t GpuScheduler::GetGetOffset() {
155 return parser_->get(); 157 return parser_->get();
156 } 158 }
157 159
158 void GpuScheduler::SetCommandProcessedCallback( 160 void GpuScheduler::SetCommandProcessedCallback(
159 const base::Closure& callback) { 161 const base::Closure& callback) {
160 command_processed_callback_ = callback; 162 command_processed_callback_ = callback;
161 } 163 }
162 164
163 bool GpuScheduler::IsPreempted() { 165 bool GpuScheduler::IsPreempted() {
164 if (!preemption_flag_.get()) 166 if (!preemption_flag_.get())
(...skipping 14 matching lines...) Expand all
179 return (decoder_ && decoder_->HasMoreIdleWork()); 181 return (decoder_ && decoder_->HasMoreIdleWork());
180 } 182 }
181 183
182 void GpuScheduler::PerformIdleWork() { 184 void GpuScheduler::PerformIdleWork() {
183 if (!decoder_) 185 if (!decoder_)
184 return; 186 return;
185 decoder_->PerformIdleWork(); 187 decoder_->PerformIdleWork();
186 } 188 }
187 189
188 } // namespace gpu 190 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_scheduler.h ('k') | gpu/command_buffer/service/gpu_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698