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

Side by Side Diff: mojo/services/network/network_service_delegate.cc

Issue 1769163002: Add a instance groups to Connect(), and introduce an Identity struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/services/network/network_service_delegate.h" 5 #include "mojo/services/network/network_service_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 30 matching lines...) Expand all
41 NetworkServiceDelegateObserver* observer) { 41 NetworkServiceDelegateObserver* observer) {
42 observers_.AddObserver(observer); 42 observers_.AddObserver(observer);
43 } 43 }
44 44
45 void NetworkServiceDelegate::RemoveObserver( 45 void NetworkServiceDelegate::RemoveObserver(
46 NetworkServiceDelegateObserver* observer) { 46 NetworkServiceDelegateObserver* observer) {
47 observers_.RemoveObserver(observer); 47 observers_.RemoveObserver(observer);
48 } 48 }
49 49
50 void NetworkServiceDelegate::Initialize(Connector* connector, 50 void NetworkServiceDelegate::Initialize(Connector* connector,
51 const std::string& name, 51 const Identity& identity,
52 const std::string& user_id,
53 uint32_t id) { 52 uint32_t id) {
54 // TODO(erg): Find everything else that writes to the filesystem and 53 // TODO(erg): Find everything else that writes to the filesystem and
55 // transition it to proxying mojo:filesystem. We shouldn't have any path 54 // transition it to proxying mojo:filesystem. We shouldn't have any path
56 // calculation code here, but sadly need it until the transition is done. In 55 // calculation code here, but sadly need it until the transition is done. In
57 // the mean time, manually handle the user-data-dir switch (which gets set in 56 // the mean time, manually handle the user-data-dir switch (which gets set in
58 // tests) so that tests are writing to a temp dir. 57 // tests) so that tests are writing to a temp dir.
59 base::FilePath base_path; 58 base::FilePath base_path;
60 const base::CommandLine* command_line = 59 const base::CommandLine* command_line =
61 base::CommandLine::ForCurrentProcess(); 60 base::CommandLine::ForCurrentProcess();
62 if (command_line->HasSwitch(kUserDataDir)) { 61 if (command_line->HasSwitch(kUserDataDir)) {
63 base_path = command_line->GetSwitchValuePath(kUserDataDir); 62 base_path = command_line->GetSwitchValuePath(kUserDataDir);
64 } else { 63 } else {
65 CHECK(PathService::Get(base::DIR_TEMP, &base_path)); 64 CHECK(PathService::Get(base::DIR_TEMP, &base_path));
66 base_path = base_path.Append(FILE_PATH_LITERAL("network_service")); 65 base_path = base_path.Append(FILE_PATH_LITERAL("network_service"));
67 } 66 }
68 67
69 context_.reset(new NetworkContext(base_path, this)); 68 context_.reset(new NetworkContext(base_path, this));
70 tracing_.Initialize(connector, name); 69 tracing_.Initialize(connector, identity.name());
71 } 70 }
72 71
73 bool NetworkServiceDelegate::AcceptConnection(Connection* connection) { 72 bool NetworkServiceDelegate::AcceptConnection(Connection* connection) {
74 DCHECK(context_); 73 DCHECK(context_);
75 connection->AddInterface<CookieStore>(this); 74 connection->AddInterface<CookieStore>(this);
76 connection->AddInterface<NetworkService>(this); 75 connection->AddInterface<NetworkService>(this);
77 connection->AddInterface<URLLoaderFactory>(this); 76 connection->AddInterface<URLLoaderFactory>(this);
78 connection->AddInterface<WebSocketFactory>(this); 77 connection->AddInterface<WebSocketFactory>(this);
79 return true; 78 return true;
80 } 79 }
(...skipping 26 matching lines...) Expand all
107 } 106 }
108 107
109 void NetworkServiceDelegate::Quit() { 108 void NetworkServiceDelegate::Quit() {
110 // Destroy the NetworkContext now as it requires MessageLoop::current() upon 109 // Destroy the NetworkContext now as it requires MessageLoop::current() upon
111 // destruction and it is the last moment we know for sure that it is 110 // destruction and it is the last moment we know for sure that it is
112 // running. 111 // running.
113 context_.reset(); 112 context_.reset();
114 } 113 }
115 114
116 } // namespace mojo 115 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/network/network_service_delegate.h ('k') | mojo/services/package_manager/package_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698