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

Side by Side Diff: mojo/shell/service_manager.cc

Issue 109103003: Mojo: abstract interface implementation from generated Stub classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shell/service_manager.h" 5 #include "mojo/shell/service_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/scoped_native_library.h" 11 #include "base/scoped_native_library.h"
12 #include "base/threading/simple_thread.h" 12 #include "base/threading/simple_thread.h"
13 #include "mojo/public/bindings/lib/remote_ptr.h" 13 #include "mojo/public/bindings/lib/remote_ptr.h"
14 #include "mojo/shell/context.h" 14 #include "mojo/shell/context.h"
15 #include "mojo/shell/switches.h" 15 #include "mojo/shell/switches.h"
16 #include "mojom/shell.h" 16 #include "mojom/shell.h"
17 17
18 typedef MojoResult (*MojoMainFunction)(MojoHandle pipe); 18 typedef MojoResult (*MojoMainFunction)(MojoHandle pipe);
19 19
20 namespace mojo { 20 namespace mojo {
21 namespace shell { 21 namespace shell {
22 22
23 class ServiceManager::Service : public ShellStub { 23 class ServiceManager::Service : public Shell {
24 public: 24 public:
25 Service(ServiceManager* manager, const GURL& url) 25 Service(ServiceManager* manager, const GURL& url)
26 : manager_(manager), 26 : manager_(manager),
27 url_(url) { 27 url_(url) {
28 MessagePipe pipe; 28 MessagePipe pipe;
29 shell_client_.reset(pipe.handle0.Pass()); 29 shell_client_.reset(pipe.handle0.Pass(), this);
30 shell_client_.SetPeer(this);
31 manager_->GetLoaderForURL(url)->Load(url, manager_, pipe.handle1.Pass()); 30 manager_->GetLoaderForURL(url)->Load(url, manager_, pipe.handle1.Pass());
32 } 31 }
33 32
34 virtual ~Service() {} 33 virtual ~Service() {}
35 34
36 void ConnectToClient(ScopedMessagePipeHandle handle) { 35 void ConnectToClient(ScopedMessagePipeHandle handle) {
37 if (handle.is_valid()) 36 if (handle.is_valid())
38 shell_client_->AcceptConnection(handle.Pass()); 37 shell_client_->AcceptConnection(handle.Pass());
39 } 38 }
40 39
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 service = service_it->second; 193 service = service_it->second;
195 } else { 194 } else {
196 service = new Service(this, url); 195 service = new Service(this, url);
197 url_to_service_[url] = service; 196 url_to_service_[url] = service;
198 } 197 }
199 service->ConnectToClient(client_handle.Pass()); 198 service->ConnectToClient(client_handle.Pass());
200 } 199 }
201 200
202 } // namespace shell 201 } // namespace shell
203 } // namespace mojo 202 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698