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

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

Issue 423963004: First cut at "content handling" support in Mojo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more gn Created 6 years, 4 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/shell/dbus_service_loader_linux.h ('k') | mojo/shell/dynamic_service_loader.h » ('j') | 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/shell/dbus_service_loader_linux.h" 5 #include "mojo/shell/dbus_service_loader_linux.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 dbus::Bus::Options options; 143 dbus::Bus::Options options;
144 options.bus_type = dbus::Bus::SESSION; 144 options.bus_type = dbus::Bus::SESSION;
145 options.dbus_task_runner = context_->task_runners()->io_runner(); 145 options.dbus_task_runner = context_->task_runners()->io_runner();
146 bus_ = new dbus::Bus(options); 146 bus_ = new dbus::Bus(options);
147 } 147 }
148 148
149 DBusServiceLoader::~DBusServiceLoader() { 149 DBusServiceLoader::~DBusServiceLoader() {
150 DCHECK(url_to_load_context_.empty()); 150 DCHECK(url_to_load_context_.empty());
151 } 151 }
152 152
153 void DBusServiceLoader::LoadService(ServiceManager* manager, 153 void DBusServiceLoader::Load(ServiceManager* manager,
154 const GURL& url, 154 const GURL& url,
155 ScopedMessagePipeHandle shell_handle) { 155 scoped_refptr<LoadCallbacks> callbacks) {
156 // TODO(aa): This could be delayed until later, when we know that loading is
157 // going to succeed.
158 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication();
159 if (!shell_handle.is_valid())
160 return;
161
156 DCHECK(url.SchemeIs("dbus")); 162 DCHECK(url.SchemeIs("dbus"));
157 DCHECK(url_to_load_context_.find(url) == url_to_load_context_.end()); 163 DCHECK(url_to_load_context_.find(url) == url_to_load_context_.end());
158 url_to_load_context_[url] = 164 url_to_load_context_[url] =
159 new LoadContext(this, bus_, url, shell_handle.Pass()); 165 new LoadContext(this, bus_, url, shell_handle.Pass());
160 } 166 }
161 167
162 void DBusServiceLoader::OnServiceError(ServiceManager* manager, 168 void DBusServiceLoader::OnServiceError(ServiceManager* manager,
163 const GURL& url) { 169 const GURL& url) {
164 // TODO(cmasone): Anything at all in this method here. 170 // TODO(cmasone): Anything at all in this method here.
165 } 171 }
166 172
167 void DBusServiceLoader::ForgetService(const GURL& url) { 173 void DBusServiceLoader::ForgetService(const GURL& url) {
168 DCHECK(context_->task_runners()->shell_runner()->BelongsToCurrentThread()); 174 DCHECK(context_->task_runners()->shell_runner()->BelongsToCurrentThread());
169 DVLOG(2) << "Forgetting service (url: " << url << ")"; 175 DVLOG(2) << "Forgetting service (url: " << url << ")";
170 176
171 LoadContextMap::iterator it = url_to_load_context_.find(url); 177 LoadContextMap::iterator it = url_to_load_context_.find(url);
172 DCHECK(it != url_to_load_context_.end()) << url; 178 DCHECK(it != url_to_load_context_.end()) << url;
173 179
174 LoadContext* doomed = it->second; 180 LoadContext* doomed = it->second;
175 url_to_load_context_.erase(it); 181 url_to_load_context_.erase(it);
176 182
177 delete doomed; 183 delete doomed;
178 } 184 }
179 185
180 } // namespace shell 186 } // namespace shell
181 } // namespace mojo 187 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/dbus_service_loader_linux.h ('k') | mojo/shell/dynamic_service_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698