OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/gpu/transport_texture_service.h" | 5 #include "content/renderer/gpu/transport_texture_service.h" |
6 | 6 |
| 7 #include "base/bind.h" |
7 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
8 #include "content/common/child_process.h" | 9 #include "content/common/child_process.h" |
9 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
10 #include "content/renderer/gpu/transport_texture_host.h" | 11 #include "content/renderer/gpu/transport_texture_host.h" |
11 | 12 |
12 TransportTextureService::TransportTextureService() | 13 TransportTextureService::TransportTextureService() |
13 : channel_(NULL), | 14 : channel_(NULL), |
14 next_host_id_(1) { | 15 next_host_id_(1) { |
15 } | 16 } |
16 | 17 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // TODO(hclam): Check this is on Render Thread. | 65 // TODO(hclam): Check this is on Render Thread. |
65 | 66 |
66 // Create the object and then add the route. | 67 // Create the object and then add the route. |
67 scoped_refptr<TransportTextureHost> host = new TransportTextureHost( | 68 scoped_refptr<TransportTextureHost> host = new TransportTextureHost( |
68 ChildProcess::current()->io_message_loop(), MessageLoop::current(), | 69 ChildProcess::current()->io_message_loop(), MessageLoop::current(), |
69 this, this, context, context_route_id, next_host_id_); | 70 this, this, context, context_route_id, next_host_id_); |
70 | 71 |
71 // Add route in the IO thread. | 72 // Add route in the IO thread. |
72 ChildProcess::current()->io_message_loop()->PostTask( | 73 ChildProcess::current()->io_message_loop()->PostTask( |
73 FROM_HERE, | 74 FROM_HERE, |
74 NewRunnableMethod(this, &TransportTextureService::AddRouteInternal, | 75 base::Bind(&TransportTextureService::AddRouteInternal, this, |
75 next_host_id_, host)); | 76 next_host_id_, host)); |
76 | 77 |
77 // Increment host ID for next object. | 78 // Increment host ID for next object. |
78 ++next_host_id_; | 79 ++next_host_id_; |
79 return host; | 80 return host; |
80 #else | 81 #else |
81 // TransportTextureHost has problem compiling on Mac so skip it. | 82 // TransportTextureHost has problem compiling on Mac so skip it. |
82 return NULL; | 83 return NULL; |
83 #endif | 84 #endif |
84 } | 85 } |
85 | 86 |
86 void TransportTextureService::RemoveRoute(int32 host_id) { | 87 void TransportTextureService::RemoveRoute(int32 host_id) { |
87 ChildProcess::current()->io_message_loop()->PostTask( | 88 ChildProcess::current()->io_message_loop()->PostTask( |
88 FROM_HERE, | 89 FROM_HERE, |
89 NewRunnableMethod(this, &TransportTextureService::RemoveRouteInternal, | 90 base::Bind(&TransportTextureService::RemoveRouteInternal, this, host_id)); |
90 host_id)); | |
91 } | 91 } |
92 | 92 |
93 bool TransportTextureService::Send(IPC::Message* msg) { | 93 bool TransportTextureService::Send(IPC::Message* msg) { |
94 ChildProcess::current()->io_message_loop()->PostTask( | 94 ChildProcess::current()->io_message_loop()->PostTask( |
95 FROM_HERE, | 95 FROM_HERE, |
96 NewRunnableMethod(this, &TransportTextureService::SendInternal, msg)); | 96 base::Bind(&TransportTextureService::SendInternal, this, msg)); |
97 return true; | 97 return true; |
98 } | 98 } |
99 | 99 |
100 void TransportTextureService::AddRouteInternal( | 100 void TransportTextureService::AddRouteInternal( |
101 int32 host_id, IPC::Channel::Listener* listener) { | 101 int32 host_id, IPC::Channel::Listener* listener) { |
102 DCHECK_EQ(ChildProcess::current()->io_message_loop(), | 102 DCHECK_EQ(ChildProcess::current()->io_message_loop(), |
103 MessageLoop::current()); | 103 MessageLoop::current()); |
104 | 104 |
105 // If router is there then just add the route, or we have to save it. | 105 // If router is there then just add the route, or we have to save it. |
106 if (router_.get()) | 106 if (router_.get()) |
(...skipping 12 matching lines...) Expand all Loading... |
119 | 119 |
120 void TransportTextureService::SendInternal(IPC::Message* msg) { | 120 void TransportTextureService::SendInternal(IPC::Message* msg) { |
121 DCHECK_EQ(ChildProcess::current()->io_message_loop(), | 121 DCHECK_EQ(ChildProcess::current()->io_message_loop(), |
122 MessageLoop::current()); | 122 MessageLoop::current()); |
123 | 123 |
124 if (channel_) | 124 if (channel_) |
125 channel_->Send(msg); | 125 channel_->Send(msg); |
126 else | 126 else |
127 pending_messages_.push_back(msg); | 127 pending_messages_.push_back(msg); |
128 } | 128 } |
OLD | NEW |