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

Unified Diff: services/shell/shell.cc

Issue 1947213002: Enable the MojoDOMSTorageBrowserTests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/app/mojo/content_browser_manifest.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/shell.cc
diff --git a/services/shell/shell.cc b/services/shell/shell.cc
index 63b5df09b5f20301815b175c1a1acfaa662571f9..5a50c317ed9af7119bc7f4d052a23bc89a5262b8 100644
--- a/services/shell/shell.cc
+++ b/services/shell/shell.cc
@@ -122,7 +122,8 @@ class Shell::Instance : public mojom::Connector,
identity_(identity),
capability_spec_(capability_spec),
allow_any_application_(capability_spec.required.count("*") == 1),
- pid_receiver_binding_(this) {
+ pid_receiver_binding_(this),
+ weak_factory_(this) {
if (identity_.name() == kShellName || identity_.name() == kCatalogName)
pid_ = base::Process::Current().Pid();
DCHECK_NE(mojom::kInvalidInstanceID, id_);
@@ -216,11 +217,10 @@ class Shell::Instance : public mojom::Connector,
CHECK(!shell_client_);
runner_ = shell_->native_runner_factory_->Create(path);
bool start_sandboxed = false;
- // We own |runner_|, so Unretained is safe here.
mojom::ShellClientPtr client = runner_->Start(
path, identity_, start_sandboxed,
- base::Bind(&Instance::PIDAvailable, base::Unretained(this)),
- base::Bind(&Instance::OnRunnerCompleted, base::Unretained(this)));
+ base::Bind(&Instance::PIDAvailable, weak_factory_.GetWeakPtr()),
+ base::Bind(&Instance::OnRunnerCompleted, weak_factory_.GetWeakPtr()));
StartWithClient(std::move(client));
}
@@ -454,6 +454,7 @@ class Shell::Instance : public mojom::Connector,
base::ProcessId pid_ = base::kNullProcessId;
Instance* parent_ = nullptr;
std::set<Instance*> children_;
+ base::WeakPtrFactory<Instance> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(Instance);
};
« no previous file with comments | « content/public/app/mojo/content_browser_manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698