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

Side by Side Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 11195011: Send vsync timebase updates to the browser compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased again. Created 8 years, 1 month 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) 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 "content/browser/gpu/browser_gpu_channel_host_factory.h" 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 #include "content/browser/gpu/gpu_data_manager_impl.h" 9 #include "content/browser/gpu/gpu_data_manager_impl.h"
10 #include "content/browser/gpu/gpu_process_host.h" 10 #include "content/browser/gpu/gpu_process_host.h"
11 #include "content/browser/gpu/gpu_surface_tracker.h" 11 #include "content/browser/gpu/gpu_surface_tracker.h"
12 #include "content/common/gpu/gpu_messages.h" 12 #include "content/common/gpu/gpu_messages.h"
13 #include "content/common/child_process_host_impl.h" 13 #include "content/common/child_process_host_impl.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/common/content_client.h" 15 #include "content/public/common/content_client.h"
16 #include "ipc/ipc_forwarding_message_filter.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; 20 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL;
20 21
21 BrowserGpuChannelHostFactory::CreateRequest::CreateRequest() 22 BrowserGpuChannelHostFactory::CreateRequest::CreateRequest()
22 : event(false, false), 23 : event(false, false),
23 gpu_host_id(0), 24 gpu_host_id(0),
24 route_id(MSG_ROUTING_NONE) { 25 route_id(MSG_ROUTING_NONE) {
25 } 26 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 gpu_channel_ = new GpuChannelHost(this, request.gpu_host_id, gpu_client_id_); 284 gpu_channel_ = new GpuChannelHost(this, request.gpu_host_id, gpu_client_id_);
284 gpu_channel_->set_gpu_info(request.gpu_info); 285 gpu_channel_->set_gpu_info(request.gpu_info);
285 GetContentClient()->SetGpuInfo(request.gpu_info); 286 GetContentClient()->SetGpuInfo(request.gpu_info);
286 287
287 // Connect to the GPU process if a channel name was received. 288 // Connect to the GPU process if a channel name was received.
288 gpu_channel_->Connect(request.channel_handle); 289 gpu_channel_->Connect(request.channel_handle);
289 290
290 return gpu_channel_.get(); 291 return gpu_channel_.get();
291 } 292 }
292 293
294 // static
295 void BrowserGpuChannelHostFactory::AddFilterOnIO(
296 int host_id,
297 scoped_refptr<IPC::ChannelProxy::MessageFilter> filter) {
298 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
299 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
300 if (host)
301 host->AddFilter(filter);
302 }
303
304 void BrowserGpuChannelHostFactory::SetHandlerForControlMessages(
305 const uint32* message_ids,
306 size_t num_messages,
307 const base::Callback<void(const IPC::Message&)>& handler,
308 base::TaskRunner* target_task_runner) {
309 scoped_refptr<IPC::ForwardingMessageFilter> filter =
310 new IPC::ForwardingMessageFilter(message_ids,
311 num_messages,
312 target_task_runner);
313 filter->AddRoute(MSG_ROUTING_CONTROL, handler);
314
315 GetIOLoopProxy()->PostTask(
316 FROM_HERE,
317 base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO,
318 gpu_host_id_,
319 filter));
320 }
321
293 } // namespace content 322 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.h ('k') | content/browser/gpu/gpu_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698