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

Side by Side Diff: gpu/ipc/client/command_buffer_proxy_impl.cc

Issue 2286873003: Provide TaskRunner to ContextCacheController (Closed)
Patch Set: feedback Created 4 years, 3 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
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/ipc/client/command_buffer_proxy_impl.h" 5 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 command_buffer_id_(CommandBufferProxyID(channel_id, route_id)), 54 command_buffer_id_(CommandBufferProxyID(channel_id, route_id)),
55 route_id_(route_id), 55 route_id_(route_id),
56 stream_id_(stream_id), 56 stream_id_(stream_id),
57 flush_count_(0), 57 flush_count_(0),
58 last_put_offset_(-1), 58 last_put_offset_(-1),
59 last_barrier_put_offset_(-1), 59 last_barrier_put_offset_(-1),
60 next_fence_sync_release_(1), 60 next_fence_sync_release_(1),
61 flushed_fence_sync_release_(0), 61 flushed_fence_sync_release_(0),
62 verified_fence_sync_release_(0), 62 verified_fence_sync_release_(0),
63 next_signal_id_(0), 63 next_signal_id_(0),
64 weak_this_(AsWeakPtr()), 64 weak_this_(AsWeakPtr()) {
65 callback_thread_(base::ThreadTaskRunnerHandle::Get()) {
66 DCHECK(route_id); 65 DCHECK(route_id);
67 DCHECK_NE(stream_id, GPU_STREAM_INVALID); 66 DCHECK_NE(stream_id, GPU_STREAM_INVALID);
68 } 67 }
69 68
70 // static 69 // static
71 std::unique_ptr<CommandBufferProxyImpl> CommandBufferProxyImpl::Create( 70 std::unique_ptr<CommandBufferProxyImpl> CommandBufferProxyImpl::Create(
72 scoped_refptr<GpuChannelHost> host, 71 scoped_refptr<GpuChannelHost> host,
73 gpu::SurfaceHandle surface_handle, 72 gpu::SurfaceHandle surface_handle,
74 CommandBufferProxyImpl* share_group, 73 CommandBufferProxyImpl* share_group,
75 int32_t stream_id, 74 int32_t stream_id,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return false; 210 return false;
212 211
213 212
214 // TODO(vadimt): Remove ScopedTracker below once crbug.com/125248 is fixed. 213 // TODO(vadimt): Remove ScopedTracker below once crbug.com/125248 is fixed.
215 tracked_objects::ScopedTracker tracking_profile( 214 tracked_objects::ScopedTracker tracking_profile(
216 FROM_HERE_WITH_EXPLICIT_FUNCTION( 215 FROM_HERE_WITH_EXPLICIT_FUNCTION(
217 "125248 CommandBufferProxyImpl::Initialize")); 216 "125248 CommandBufferProxyImpl::Initialize"));
218 217
219 // Route must be added before sending the message, otherwise messages sent 218 // Route must be added before sending the message, otherwise messages sent
220 // from the GPU process could race against adding ourselves to the filter. 219 // from the GPU process could race against adding ourselves to the filter.
221 channel->AddRouteWithTaskRunner(route_id_, AsWeakPtr(), 220 channel->AddRouteWithTaskRunner(route_id_, AsWeakPtr(), task_runner);
222 std::move(task_runner));
223 221
224 // We're blocking the UI thread, which is generally undesirable. 222 // We're blocking the UI thread, which is generally undesirable.
225 // In this case we need to wait for this before we can show any UI /anyway/, 223 // In this case we need to wait for this before we can show any UI /anyway/,
226 // so it won't cause additional jank. 224 // so it won't cause additional jank.
227 // TODO(piman): Make this asynchronous (http://crbug.com/125248). 225 // TODO(piman): Make this asynchronous (http://crbug.com/125248).
228 bool result = false; 226 bool result = false;
229 bool sent = channel->Send(new GpuChannelMsg_CreateCommandBuffer( 227 bool sent = channel->Send(new GpuChannelMsg_CreateCommandBuffer(
230 config, route_id_, handle, &result, &capabilities_)); 228 config, route_id_, handle, &result, &capabilities_));
231 if (!sent || !result) { 229 if (!sent || !result) {
232 DLOG(ERROR) << "Failed to send GpuChannelMsg_CreateCommandBuffer."; 230 DLOG(ERROR) << "Failed to send GpuChannelMsg_CreateCommandBuffer.";
233 channel->RemoveRoute(route_id_); 231 channel->RemoveRoute(route_id_);
234 return false; 232 return false;
235 } 233 }
236 234
237 channel_ = std::move(channel); 235 channel_ = std::move(channel);
238 capabilities_.image = true; 236 capabilities_.image = true;
237 callback_thread_ = std::move(task_runner);
239 238
240 return true; 239 return true;
241 } 240 }
242 241
243 gpu::CommandBuffer::State CommandBufferProxyImpl::GetLastState() { 242 gpu::CommandBuffer::State CommandBufferProxyImpl::GetLastState() {
244 return last_state_; 243 return last_state_;
245 } 244 }
246 245
247 int32_t CommandBufferProxyImpl::GetLastToken() { 246 int32_t CommandBufferProxyImpl::GetLastToken() {
248 TryUpdateState(); 247 TryUpdateState();
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 return; 867 return;
869 channel_->FlushPendingStream(stream_id_); 868 channel_->FlushPendingStream(stream_id_);
870 channel_->Send(new GpuChannelMsg_DestroyCommandBuffer(route_id_)); 869 channel_->Send(new GpuChannelMsg_DestroyCommandBuffer(route_id_));
871 channel_->RemoveRoute(route_id_); 870 channel_->RemoveRoute(route_id_);
872 channel_ = nullptr; 871 channel_ = nullptr;
873 if (gpu_control_client_) 872 if (gpu_control_client_)
874 gpu_control_client_->OnGpuControlLostContext(); 873 gpu_control_client_->OnGpuControlLostContext();
875 } 874 }
876 875
877 } // namespace gpu 876 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.cc ('k') | gpu/ipc/client/gpu_in_process_context_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698