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

Side by Side Diff: chrome/app/mash/mash_runner.cc

Issue 1899083002: Convert //chrome from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/app/mash/mash_runner.h" 5 #include "chrome/app/mash/mash_runner.h"
6 6
7 #include "ash/mus/sysui_application.h" 7 #include "ash/mus/sysui_application.h"
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 shell_connection_.reset( 76 shell_connection_.reset(
77 new shell::ShellConnection(shell_client_.get(), std::move(request))); 77 new shell::ShellConnection(shell_client_.get(), std::move(request)));
78 return; 78 return;
79 } 79 }
80 LOG(ERROR) << "unknown name " << mojo_name; 80 LOG(ERROR) << "unknown name " << mojo_name;
81 NOTREACHED(); 81 NOTREACHED();
82 } 82 }
83 83
84 private: 84 private:
85 // TODO(sky): move this into mash. 85 // TODO(sky): move this into mash.
86 scoped_ptr<shell::ShellClient> CreateShellClient(const std::string& name) { 86 std::unique_ptr<shell::ShellClient> CreateShellClient(
87 const std::string& name) {
87 if (name == "mojo:ash_sysui") 88 if (name == "mojo:ash_sysui")
88 return base::WrapUnique(new ash::sysui::SysUIApplication); 89 return base::WrapUnique(new ash::sysui::SysUIApplication);
89 if (name == "mojo:desktop_wm") 90 if (name == "mojo:desktop_wm")
90 return base::WrapUnique(new mash::wm::WindowManagerApplication); 91 return base::WrapUnique(new mash::wm::WindowManagerApplication);
91 if (name == "mojo:mash_session") 92 if (name == "mojo:mash_session")
92 return base::WrapUnique(new mash::session::Session); 93 return base::WrapUnique(new mash::session::Session);
93 if (name == "mojo:mus") 94 if (name == "mojo:mus")
94 return base::WrapUnique(new mus::MandolineUIServicesApp); 95 return base::WrapUnique(new mus::MandolineUIServicesApp);
95 if (name == "mojo:quick_launch") 96 if (name == "mojo:quick_launch")
96 return base::WrapUnique(new mash::quick_launch::QuickLaunchApplication); 97 return base::WrapUnique(new mash::quick_launch::QuickLaunchApplication);
97 if (name == "mojo:resource_provider") { 98 if (name == "mojo:resource_provider") {
98 return base::WrapUnique( 99 return base::WrapUnique(
99 new resource_provider::ResourceProviderApp("mojo:resource_provider")); 100 new resource_provider::ResourceProviderApp("mojo:resource_provider"));
100 } 101 }
101 if (name == "mojo:task_viewer") 102 if (name == "mojo:task_viewer")
102 return base::WrapUnique(new mash::task_viewer::TaskViewer); 103 return base::WrapUnique(new mash::task_viewer::TaskViewer);
103 #if defined(OS_LINUX) 104 #if defined(OS_LINUX)
104 if (name == "mojo:font_service") 105 if (name == "mojo:font_service")
105 return base::WrapUnique(new font_service::FontServiceApp); 106 return base::WrapUnique(new font_service::FontServiceApp);
106 #endif 107 #endif
107 if (name == "mojo:browser_driver") { 108 if (name == "mojo:browser_driver") {
108 return base::WrapUnique( 109 return base::WrapUnique(
109 new mash::browser_driver::BrowserDriverApplicationDelegate()); 110 new mash::browser_driver::BrowserDriverApplicationDelegate());
110 } 111 }
111 return nullptr; 112 return nullptr;
112 } 113 }
113 114
114 mojo::BindingSet<ShellClientFactory> shell_client_factory_bindings_; 115 mojo::BindingSet<ShellClientFactory> shell_client_factory_bindings_;
115 scoped_ptr<shell::ShellClient> shell_client_; 116 std::unique_ptr<shell::ShellClient> shell_client_;
116 scoped_ptr<shell::ShellConnection> shell_connection_; 117 std::unique_ptr<shell::ShellConnection> shell_connection_;
117 118
118 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); 119 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient);
119 }; 120 };
120 121
121 bool IsChild() { 122 bool IsChild() {
122 return base::CommandLine::ForCurrentProcess()->HasSwitch( 123 return base::CommandLine::ForCurrentProcess()->HasSwitch(
123 switches::kProcessType) && 124 switches::kProcessType) &&
124 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 125 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
125 switches::kProcessType) == kMashChild; 126 switches::kProcessType) == kMashChild;
126 } 127 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 else 182 else
182 RunMain(); 183 RunMain();
183 } 184 }
184 185
185 void MashRunner::RunMain() { 186 void MashRunner::RunMain() {
186 // TODO(sky): refactor backgroundshell so can supply own context, we 187 // TODO(sky): refactor backgroundshell so can supply own context, we
187 // shouldn't we using context as it has a lot of stuff we don't really want 188 // shouldn't we using context as it has a lot of stuff we don't really want
188 // in chrome. 189 // in chrome.
189 NativeRunnerDelegateImpl native_runner_delegate; 190 NativeRunnerDelegateImpl native_runner_delegate;
190 shell::BackgroundShell background_shell; 191 shell::BackgroundShell background_shell;
191 scoped_ptr<shell::BackgroundShell::InitParams> init_params( 192 std::unique_ptr<shell::BackgroundShell::InitParams> init_params(
192 new shell::BackgroundShell::InitParams); 193 new shell::BackgroundShell::InitParams);
193 init_params->native_runner_delegate = &native_runner_delegate; 194 init_params->native_runner_delegate = &native_runner_delegate;
194 background_shell.Init(std::move(init_params)); 195 background_shell.Init(std::move(init_params));
195 shell_client_.reset(new DefaultShellClient); 196 shell_client_.reset(new DefaultShellClient);
196 shell_connection_.reset(new shell::ShellConnection( 197 shell_connection_.reset(new shell::ShellConnection(
197 shell_client_.get(), 198 shell_client_.get(),
198 background_shell.CreateShellClientRequest("exe:chrome_mash"))); 199 background_shell.CreateShellClientRequest("exe:chrome_mash")));
199 shell_connection_->connector()->Connect("mojo:mash_session"); 200 shell_connection_->connector()->Connect("mojo:mash_session");
200 base::MessageLoop::current()->Run(); 201 base::MessageLoop::current()->Run();
201 } 202 }
(...skipping 22 matching lines...) Expand all
224 logging::LoggingSettings settings; 225 logging::LoggingSettings settings;
225 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 226 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
226 logging::InitLogging(settings); 227 logging::InitLogging(settings);
227 // To view log output with IDs and timestamps use "adb logcat -v threadtime". 228 // To view log output with IDs and timestamps use "adb logcat -v threadtime".
228 logging::SetLogItems(true, // Process ID 229 logging::SetLogItems(true, // Process ID
229 true, // Thread ID 230 true, // Thread ID
230 true, // Timestamp 231 true, // Timestamp
231 true); // Tick count 232 true); // Tick count
232 233
233 // TODO(sky): use MessagePumpMojo. 234 // TODO(sky): use MessagePumpMojo.
234 scoped_ptr<base::MessageLoop> message_loop; 235 std::unique_ptr<base::MessageLoop> message_loop;
235 #if defined(OS_LINUX) 236 #if defined(OS_LINUX)
236 base::AtExitManager exit_manager; 237 base::AtExitManager exit_manager;
237 #endif 238 #endif
238 if (!IsChild()) 239 if (!IsChild())
239 message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); 240 message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
240 MashRunner mash_runner; 241 MashRunner mash_runner;
241 mash_runner.Run(); 242 mash_runner.Run();
242 return 0; 243 return 0;
243 } 244 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698