OLD | NEW |
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/common/child_thread.h" | 5 #include "content/common/child_thread.h" |
6 | 6 |
7 #include "base/allocator/allocator_extension.h" | 7 #include "base/allocator/allocator_extension.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/process.h" | 10 #include "base/process.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool ChildThread::Send(IPC::Message* msg) { | 94 bool ChildThread::Send(IPC::Message* msg) { |
95 DCHECK(MessageLoop::current() == message_loop()); | 95 DCHECK(MessageLoop::current() == message_loop()); |
96 if (!channel_.get()) { | 96 if (!channel_.get()) { |
97 delete msg; | 97 delete msg; |
98 return false; | 98 return false; |
99 } | 99 } |
100 | 100 |
101 return channel_->Send(msg); | 101 return channel_->Send(msg); |
102 } | 102 } |
103 | 103 |
104 void ChildThread::AddRoute(int32 routing_id, IPC::Channel::Listener* listener) { | 104 void ChildThread::AddRoute(int32 routing_id, IPC::Listener* listener) { |
105 DCHECK(MessageLoop::current() == message_loop()); | 105 DCHECK(MessageLoop::current() == message_loop()); |
106 | 106 |
107 router_.AddRoute(routing_id, listener); | 107 router_.AddRoute(routing_id, listener); |
108 } | 108 } |
109 | 109 |
110 void ChildThread::RemoveRoute(int32 routing_id) { | 110 void ChildThread::RemoveRoute(int32 routing_id) { |
111 DCHECK(MessageLoop::current() == message_loop()); | 111 DCHECK(MessageLoop::current() == message_loop()); |
112 | 112 |
113 router_.RemoveRoute(routing_id); | 113 router_.RemoveRoute(routing_id); |
114 } | 114 } |
115 | 115 |
116 IPC::Channel::Listener* ChildThread::ResolveRoute(int32 routing_id) { | 116 IPC::Listener* ChildThread::ResolveRoute(int32 routing_id) { |
117 DCHECK(MessageLoop::current() == message_loop()); | 117 DCHECK(MessageLoop::current() == message_loop()); |
118 | 118 |
119 return router_.ResolveRoute(routing_id); | 119 return router_.ResolveRoute(routing_id); |
120 } | 120 } |
121 | 121 |
122 webkit_glue::ResourceLoaderBridge* ChildThread::CreateBridge( | 122 webkit_glue::ResourceLoaderBridge* ChildThread::CreateBridge( |
123 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 123 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
124 return resource_dispatcher()->CreateBridge(request_info); | 124 return resource_dispatcher()->CreateBridge(request_info); |
125 } | 125 } |
126 | 126 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 276 } |
277 | 277 |
278 // The child process shutdown sequence is a request response based mechanism, | 278 // The child process shutdown sequence is a request response based mechanism, |
279 // where we send out an initial feeler request to the child process host | 279 // where we send out an initial feeler request to the child process host |
280 // instance in the browser to verify if it's ok to shutdown the child process. | 280 // instance in the browser to verify if it's ok to shutdown the child process. |
281 // The browser then sends back a response if it's ok to shutdown. This avoids | 281 // The browser then sends back a response if it's ok to shutdown. This avoids |
282 // race conditions if the process refcount is 0 but there's an IPC message | 282 // race conditions if the process refcount is 0 but there's an IPC message |
283 // inflight that would addref it. | 283 // inflight that would addref it. |
284 Send(new ChildProcessHostMsg_ShutdownRequest); | 284 Send(new ChildProcessHostMsg_ShutdownRequest); |
285 } | 285 } |
OLD | NEW |