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

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

Issue 399663002: Have mojo_shell run in its custom thread on android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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/context.cc ('k') | mojo/shell/keep_alive.cc » ('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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 mojo::MessagePipeHandle( 109 mojo::MessagePipeHandle(
110 service_provider_handle_.release().value()))); 110 service_provider_handle_.release().value())));
111 } 111 }
112 112
113 // Should the ExternalService disappear completely, destroy connection state. 113 // Should the ExternalService disappear completely, destroy connection state.
114 // NB: This triggers off of the service disappearing from 114 // NB: This triggers off of the service disappearing from
115 // DBus. Perhaps there's a way to watch at the Mojo layer instead, 115 // DBus. Perhaps there's a way to watch at the Mojo layer instead,
116 // and that would be superior? 116 // and that would be superior?
117 void HandleNameOwnerChanged(const std::string& old_owner, 117 void HandleNameOwnerChanged(const std::string& old_owner,
118 const std::string& new_owner) { 118 const std::string& new_owner) {
119 DCHECK(loader_->context_->task_runners()->ui_runner()-> 119 DCHECK(loader_->context_->task_runners()->shell_runner()->
120 BelongsToCurrentThread()); 120 BelongsToCurrentThread());
121 121
122 if (new_owner.empty()) { 122 if (new_owner.empty()) {
123 loader_->context_->task_runners()->ui_runner()->PostTask( 123 loader_->context_->task_runners()->shell_runner()->PostTask(
124 FROM_HERE, 124 FROM_HERE,
125 base::Bind(&DBusServiceLoader::ForgetService, 125 base::Bind(&DBusServiceLoader::ForgetService,
126 base::Unretained(loader_), url_)); 126 base::Unretained(loader_), url_));
127 } 127 }
128 } 128 }
129 129
130 DBusServiceLoader* const loader_; 130 DBusServiceLoader* const loader_;
131 scoped_refptr<dbus::Bus> bus_; 131 scoped_refptr<dbus::Bus> bus_;
132 dbus::ObjectProxy* service_dbus_proxy_; // Owned by bus_; 132 dbus::ObjectProxy* service_dbus_proxy_; // Owned by bus_;
133 const GURL url_; 133 const GURL url_;
(...skipping 24 matching lines...) Expand all
158 url_to_load_context_[url] = 158 url_to_load_context_[url] =
159 new LoadContext(this, bus_, url, shell_handle.Pass()); 159 new LoadContext(this, bus_, url, shell_handle.Pass());
160 } 160 }
161 161
162 void DBusServiceLoader::OnServiceError(ServiceManager* manager, 162 void DBusServiceLoader::OnServiceError(ServiceManager* manager,
163 const GURL& url) { 163 const GURL& url) {
164 // TODO(cmasone): Anything at all in this method here. 164 // TODO(cmasone): Anything at all in this method here.
165 } 165 }
166 166
167 void DBusServiceLoader::ForgetService(const GURL& url) { 167 void DBusServiceLoader::ForgetService(const GURL& url) {
168 DCHECK(context_->task_runners()->ui_runner()->BelongsToCurrentThread()); 168 DCHECK(context_->task_runners()->shell_runner()->BelongsToCurrentThread());
169 DVLOG(2) << "Forgetting service (url: " << url << ")"; 169 DVLOG(2) << "Forgetting service (url: " << url << ")";
170 170
171 LoadContextMap::iterator it = url_to_load_context_.find(url); 171 LoadContextMap::iterator it = url_to_load_context_.find(url);
172 DCHECK(it != url_to_load_context_.end()) << url; 172 DCHECK(it != url_to_load_context_.end()) << url;
173 173
174 LoadContext* doomed = it->second; 174 LoadContext* doomed = it->second;
175 url_to_load_context_.erase(it); 175 url_to_load_context_.erase(it);
176 176
177 delete doomed; 177 delete doomed;
178 } 178 }
179 179
180 } // namespace shell 180 } // namespace shell
181 } // namespace mojo 181 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/context.cc ('k') | mojo/shell/keep_alive.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698