OLD | NEW |
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 "mojo/spy/spy.h" | 5 #include "mojo/spy/spy.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 239 |
240 // You can get an invalid handle if the app (or service) is | 240 // You can get an invalid handle if the app (or service) is |
241 // created by unconventional means, for example the command line. | 241 // created by unconventional means, for example the command line. |
242 if (!real_client) | 242 if (!real_client) |
243 return real_client.Pass(); | 243 return real_client.Pass(); |
244 | 244 |
245 mojo::ScopedMessagePipeHandle faux_client; | 245 mojo::ScopedMessagePipeHandle faux_client; |
246 mojo::ScopedMessagePipeHandle interceptor; | 246 mojo::ScopedMessagePipeHandle interceptor; |
247 CreateMessagePipe(NULL, &faux_client, &interceptor); | 247 CreateMessagePipe(NULL, &faux_client, &interceptor); |
248 | 248 |
249 scoped_refptr<MessageProcessor> processor = new MessageProcessor( | 249 scoped_refptr<MessageProcessor> processor = |
250 control_loop_proxy_); | 250 new MessageProcessor(control_loop_proxy_.get()); |
251 mojo::ScopedMessagePipeHandle real_handle = real_client.PassMessagePipe(); | 251 mojo::ScopedMessagePipeHandle real_handle = real_client.PassMessagePipe(); |
252 base::WorkerPool::PostTask( | 252 base::WorkerPool::PostTask( |
253 FROM_HERE, | 253 FROM_HERE, |
254 base::Bind(&MessageProcessor::Start, | 254 base::Bind(&MessageProcessor::Start, |
255 processor, | 255 processor, |
256 base::Passed(&real_handle), base::Passed(&interceptor), | 256 base::Passed(&real_handle), base::Passed(&interceptor), |
257 url), | 257 url), |
258 true); | 258 true); |
259 | 259 |
260 mojo::ServiceProviderPtr faux_provider; | 260 mojo::ServiceProviderPtr faux_provider; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 application_manager->SetInterceptor( | 329 application_manager->SetInterceptor( |
330 new SpyInterceptor(spy_server_, control_thread_->message_loop_proxy())); | 330 new SpyInterceptor(spy_server_, control_thread_->message_loop_proxy())); |
331 } | 331 } |
332 | 332 |
333 Spy::~Spy() { | 333 Spy::~Spy() { |
334 // TODO(cpu): Do not leak the interceptor. Lifetime between the | 334 // TODO(cpu): Do not leak the interceptor. Lifetime between the |
335 // application_manager and the spy is still unclear hence the leak. | 335 // application_manager and the spy is still unclear hence the leak. |
336 } | 336 } |
337 | 337 |
338 } // namespace mojo | 338 } // namespace mojo |
OLD | NEW |