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

Side by Side Diff: components/view_manager/gles2/command_buffer_impl.cc

Issue 1231263003: Share SyncPointManager between ipc and in-process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove forward decl/includes Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/view_manager/gles2/command_buffer_impl.h" 5 #include "components/view_manager/gles2/command_buffer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "components/view_manager/gles2/command_buffer_driver.h" 9 #include "components/view_manager/gles2/command_buffer_driver.h"
10 #include "components/view_manager/gles2/command_buffer_impl_observer.h" 10 #include "components/view_manager/gles2/command_buffer_impl_observer.h"
11 #include "components/view_manager/gles2/gpu_state.h"
11 #include "gpu/command_buffer/service/sync_point_manager.h" 12 #include "gpu/command_buffer/service/sync_point_manager.h"
12 13
13 namespace gles2 { 14 namespace gles2 {
14 namespace { 15 namespace {
15 void RunCallback(const mojo::Callback<void()>& callback) { 16 void RunCallback(const mojo::Callback<void()>& callback) {
16 callback.Run(); 17 callback.Run();
17 } 18 }
18 } // namespace 19 } // namespace
19 20
20 class CommandBufferImpl::CommandBufferDriverClientImpl 21 class CommandBufferImpl::CommandBufferDriverClientImpl
(...skipping 11 matching lines...) Expand all
32 void DidLoseContext() override { command_buffer_->DidLoseContext(); } 33 void DidLoseContext() override { command_buffer_->DidLoseContext(); }
33 34
34 CommandBufferImpl* command_buffer_; 35 CommandBufferImpl* command_buffer_;
35 36
36 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriverClientImpl); 37 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriverClientImpl);
37 }; 38 };
38 39
39 CommandBufferImpl::CommandBufferImpl( 40 CommandBufferImpl::CommandBufferImpl(
40 mojo::InterfaceRequest<mojo::CommandBuffer> request, 41 mojo::InterfaceRequest<mojo::CommandBuffer> request,
41 mojo::ViewportParameterListenerPtr listener, 42 mojo::ViewportParameterListenerPtr listener,
42 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner, 43 scoped_refptr<GpuState> gpu_state,
43 gpu::SyncPointManager* sync_point_manager,
44 scoped_ptr<CommandBufferDriver> driver) 44 scoped_ptr<CommandBufferDriver> driver)
45 : sync_point_manager_(sync_point_manager), 45 : gpu_state_(gpu_state),
46 driver_task_runner_(base::MessageLoop::current()->task_runner()), 46 driver_task_runner_(base::MessageLoop::current()->task_runner()),
47 driver_(driver.Pass()), 47 driver_(driver.Pass()),
48 viewport_parameter_listener_(listener.Pass()), 48 viewport_parameter_listener_(listener.Pass()),
49 binding_(this), 49 binding_(this),
50 observer_(nullptr) { 50 observer_(nullptr) {
51 driver_->set_client(make_scoped_ptr(new CommandBufferDriverClientImpl(this))); 51 driver_->set_client(make_scoped_ptr(new CommandBufferDriverClientImpl(this)));
52 52
53 control_task_runner->PostTask( 53 gpu_state_->control_task_runner()->PostTask(
54 FROM_HERE, base::Bind(&CommandBufferImpl::BindToRequest, 54 FROM_HERE, base::Bind(&CommandBufferImpl::BindToRequest,
55 base::Unretained(this), base::Passed(&request))); 55 base::Unretained(this), base::Passed(&request)));
56 } 56 }
57 57
58 void CommandBufferImpl::Initialize( 58 void CommandBufferImpl::Initialize(
59 mojo::CommandBufferSyncClientPtr sync_client, 59 mojo::CommandBufferSyncClientPtr sync_client,
60 mojo::CommandBufferSyncPointClientPtr sync_point_client, 60 mojo::CommandBufferSyncPointClientPtr sync_point_client,
61 mojo::CommandBufferLostContextObserverPtr loss_observer, 61 mojo::CommandBufferLostContextObserverPtr loss_observer,
62 mojo::ScopedSharedBufferHandle shared_state) { 62 mojo::ScopedSharedBufferHandle shared_state) {
63 sync_point_client_ = sync_point_client.Pass(); 63 sync_point_client_ = sync_point_client.Pass();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 base::Passed(&transfer_buffer), size)); 97 base::Passed(&transfer_buffer), size));
98 } 98 }
99 99
100 void CommandBufferImpl::DestroyTransferBuffer(int32_t id) { 100 void CommandBufferImpl::DestroyTransferBuffer(int32_t id) {
101 driver_task_runner_->PostTask( 101 driver_task_runner_->PostTask(
102 FROM_HERE, base::Bind(&CommandBufferDriver::DestroyTransferBuffer, 102 FROM_HERE, base::Bind(&CommandBufferDriver::DestroyTransferBuffer,
103 base::Unretained(driver_.get()), id)); 103 base::Unretained(driver_.get()), id));
104 } 104 }
105 105
106 void CommandBufferImpl::InsertSyncPoint(bool retire) { 106 void CommandBufferImpl::InsertSyncPoint(bool retire) {
107 uint32_t sync_point = sync_point_manager_->GenerateSyncPoint(); 107 uint32_t sync_point = gpu_state_->sync_point_manager()->GenerateSyncPoint();
108 sync_point_client_->DidInsertSyncPoint(sync_point); 108 sync_point_client_->DidInsertSyncPoint(sync_point);
109 if (retire) { 109 if (retire) {
110 driver_task_runner_->PostTask( 110 driver_task_runner_->PostTask(
111 FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint, 111 FROM_HERE,
112 sync_point_manager_, sync_point)); 112 base::Bind(&gpu::SyncPointManager::RetireSyncPoint,
113 base::Unretained(gpu_state_->sync_point_manager()),
114 sync_point));
113 } 115 }
114 } 116 }
115 117
116 void CommandBufferImpl::RetireSyncPoint(uint32_t sync_point) { 118 void CommandBufferImpl::RetireSyncPoint(uint32_t sync_point) {
117 driver_task_runner_->PostTask( 119 driver_task_runner_->PostTask(
118 FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint, 120 FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint,
119 sync_point_manager_, sync_point)); 121 base::Unretained(gpu_state_->sync_point_manager()),
122 sync_point));
120 } 123 }
121 124
122 void CommandBufferImpl::Echo(const mojo::Callback<void()>& callback) { 125 void CommandBufferImpl::Echo(const mojo::Callback<void()>& callback) {
123 driver_task_runner_->PostTaskAndReply(FROM_HERE, base::Bind(&base::DoNothing), 126 driver_task_runner_->PostTaskAndReply(FROM_HERE, base::Bind(&base::DoNothing),
124 base::Bind(&RunCallback, callback)); 127 base::Bind(&RunCallback, callback));
125 } 128 }
126 129
127 void CommandBufferImpl::CreateImage(int32_t id, 130 void CommandBufferImpl::CreateImage(int32_t id,
128 mojo::ScopedHandle memory_handle, 131 mojo::ScopedHandle memory_handle,
129 int32 type, 132 int32 type,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 175
173 void CommandBufferImpl::UpdateVSyncParameters(base::TimeTicks timebase, 176 void CommandBufferImpl::UpdateVSyncParameters(base::TimeTicks timebase,
174 base::TimeDelta interval) { 177 base::TimeDelta interval) {
175 if (!viewport_parameter_listener_) 178 if (!viewport_parameter_listener_)
176 return; 179 return;
177 viewport_parameter_listener_->OnVSyncParametersUpdated( 180 viewport_parameter_listener_->OnVSyncParametersUpdated(
178 timebase.ToInternalValue(), interval.ToInternalValue()); 181 timebase.ToInternalValue(), interval.ToInternalValue());
179 } 182 }
180 183
181 } // namespace gles2 184 } // namespace gles2
OLDNEW
« no previous file with comments | « components/view_manager/gles2/command_buffer_impl.h ('k') | components/view_manager/gles2/gpu_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698