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

Side by Side Diff: chrome/browser/gpu_process_host_ui_shim.cc

Issue 1546001: Split GpuProcessHost into GpuProcessHostUIShim, which runs on the UI... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 | « chrome/browser/gpu_process_host_ui_shim.h ('k') | chrome/browser/io_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/gpu_process_host_ui_shim.h"
6
7 #include "chrome/browser/chrome_thread.h"
8 #include "chrome/browser/gpu_process_host.h"
9 #include "chrome/common/gpu_messages.h"
10
11 // Tasks used by this file
12 namespace {
13
14 class SendOnIOThreadTask : public Task {
15 public:
16 explicit SendOnIOThreadTask(IPC::Message* msg) : msg_(msg) {
17 }
18
19 private:
20 void Run() {
21 GpuProcessHost::Get()->Send(msg_);
22 }
23 IPC::Message* msg_;
24 };
25
26 } // namespace
27
28 GpuProcessHostUIShim::GpuProcessHostUIShim() : last_routing_id_(1) {
29 }
30
31 GpuProcessHostUIShim::~GpuProcessHostUIShim() {
32 }
33
34 // static
35 GpuProcessHostUIShim* GpuProcessHostUIShim::Get() {
36 return Singleton<GpuProcessHostUIShim>::get();
37 }
38
39 int32 GpuProcessHostUIShim::NewRenderWidgetHostView(
40 GpuNativeWindowHandle parent) {
41 int32 routing_id = GetNextRoutingId();
42 Send(new GpuMsg_NewRenderWidgetHostView(parent, routing_id));
43 return routing_id;
44 }
45
46 bool GpuProcessHostUIShim::Send(IPC::Message* msg) {
47 ChromeThread::PostTask(ChromeThread::IO,
48 FROM_HERE,
49 new SendOnIOThreadTask(msg));
50 return true;
51 }
52
53 int32 GpuProcessHostUIShim::GetNextRoutingId() {
54 return ++last_routing_id_;
55 }
56
57 void GpuProcessHostUIShim::AddRoute(int32 routing_id,
58 IPC::Channel::Listener* listener) {
59 router_.AddRoute(routing_id, listener);
60 }
61
62 void GpuProcessHostUIShim::RemoveRoute(int32 routing_id) {
63 router_.RemoveRoute(routing_id);
64 }
65
66 void GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) {
67 router_.RouteMessage(message);
68 }
69
OLDNEW
« no previous file with comments | « chrome/browser/gpu_process_host_ui_shim.h ('k') | chrome/browser/io_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698