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

Side by Side Diff: mojo/spy/spy.cc

Issue 328753003: Mojo: Plumb MojoCreateMessagePipeOptions through to the C++ wrappers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 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 | « mojo/public/cpp/system/tests/core_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (!MustIntercept(url)) 131 if (!MustIntercept(url))
132 return real_client.Pass(); 132 return real_client.Pass();
133 133
134 // You can get an invalid handle if the app (or service) is 134 // You can get an invalid handle if the app (or service) is
135 // created by unconventional means, for example the command line. 135 // created by unconventional means, for example the command line.
136 if (!real_client.is_valid()) 136 if (!real_client.is_valid())
137 return real_client.Pass(); 137 return real_client.Pass();
138 138
139 mojo::ScopedMessagePipeHandle faux_client; 139 mojo::ScopedMessagePipeHandle faux_client;
140 mojo::ScopedMessagePipeHandle interceptor; 140 mojo::ScopedMessagePipeHandle interceptor;
141 CreateMessagePipe(&faux_client, &interceptor); 141 CreateMessagePipe(NULL, &faux_client, &interceptor);
142 142
143 scoped_refptr<MessageProcessor> processor = new MessageProcessor(); 143 scoped_refptr<MessageProcessor> processor = new MessageProcessor();
144 base::WorkerPool::PostTask( 144 base::WorkerPool::PostTask(
145 FROM_HERE, 145 FROM_HERE,
146 base::Bind(&MessageProcessor::Start, 146 base::Bind(&MessageProcessor::Start,
147 processor, 147 processor,
148 base::Passed(&real_client), base::Passed(&interceptor)), 148 base::Passed(&real_client), base::Passed(&interceptor)),
149 true); 149 true);
150 150
151 return faux_client.Pass(); 151 return faux_client.Pass();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // Start intercepting mojo services. 206 // Start intercepting mojo services.
207 service_manager->SetInterceptor(new SpyInterceptor()); 207 service_manager->SetInterceptor(new SpyInterceptor());
208 } 208 }
209 209
210 Spy::~Spy(){ 210 Spy::~Spy(){
211 // TODO(cpu): Do not leak the interceptor. Lifetime between the 211 // TODO(cpu): Do not leak the interceptor. Lifetime between the
212 // service_manager and the spy is still unclear hence the leak. 212 // service_manager and the spy is still unclear hence the leak.
213 } 213 }
214 214
215 } // namespace mojo 215 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/system/tests/core_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698