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

Side by Side Diff: ui/aura/demo/demo_main.cc

Issue 1871253002: aura: Require explicit ownership of the Env instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot.merge 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
« no previous file with comments | « headless/lib/browser/headless_browser_main_parts.cc ('k') | ui/aura/env.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <memory>
6
5 #include "base/at_exit.h" 7 #include "base/at_exit.h"
6 #include "base/command_line.h" 8 #include "base/command_line.h"
7 #include "base/i18n/icu_util.h" 9 #include "base/i18n/icu_util.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
11 #include "base/power_monitor/power_monitor.h" 13 #include "base/power_monitor/power_monitor.h"
12 #include "base/power_monitor/power_monitor_device_source.h" 14 #include "base/power_monitor/power_monitor_device_source.h"
13 #include "build/build_config.h" 15 #include "build/build_config.h"
14 #include "third_party/skia/include/core/SkXfermode.h" 16 #include "third_party/skia/include/core/SkXfermode.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 scoped_ptr<ui::InProcessContextFactory> context_factory( 141 scoped_ptr<ui::InProcessContextFactory> context_factory(
140 new ui::InProcessContextFactory(context_factory_for_test, nullptr)); 142 new ui::InProcessContextFactory(context_factory_for_test, nullptr));
141 context_factory->set_use_test_surface(false); 143 context_factory->set_use_test_surface(false);
142 144
143 // Create the message-loop here before creating the root window. 145 // Create the message-loop here before creating the root window.
144 base::MessageLoopForUI message_loop; 146 base::MessageLoopForUI message_loop;
145 147
146 base::PowerMonitor power_monitor(make_scoped_ptr( 148 base::PowerMonitor power_monitor(make_scoped_ptr(
147 new base::PowerMonitorDeviceSource)); 149 new base::PowerMonitorDeviceSource));
148 150
149 aura::Env::CreateInstance(true); 151 std::unique_ptr<aura::Env> env = aura::Env::CreateInstance();
150 aura::Env::GetInstance()->set_context_factory(context_factory.get()); 152 env->set_context_factory(context_factory.get());
151 scoped_ptr<aura::TestScreen> test_screen( 153 scoped_ptr<aura::TestScreen> test_screen(
152 aura::TestScreen::Create(gfx::Size())); 154 aura::TestScreen::Create(gfx::Size()));
153 gfx::Screen::SetScreenInstance(test_screen.get()); 155 gfx::Screen::SetScreenInstance(test_screen.get());
154 scoped_ptr<aura::WindowTreeHost> host( 156 scoped_ptr<aura::WindowTreeHost> host(
155 test_screen->CreateHostForPrimaryDisplay()); 157 test_screen->CreateHostForPrimaryDisplay());
156 scoped_ptr<DemoWindowTreeClient> window_tree_client( 158 scoped_ptr<DemoWindowTreeClient> window_tree_client(
157 new DemoWindowTreeClient(host->window())); 159 new DemoWindowTreeClient(host->window()));
158 aura::test::TestFocusClient focus_client; 160 aura::test::TestFocusClient focus_client;
159 aura::client::SetFocusClient(host->window(), &focus_client); 161 aura::client::SetFocusClient(host->window(), &focus_client);
160 162
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 int main(int argc, char** argv) { 199 int main(int argc, char** argv) {
198 base::CommandLine::Init(argc, argv); 200 base::CommandLine::Init(argc, argv);
199 201
200 // The exit manager is in charge of calling the dtors of singleton objects. 202 // The exit manager is in charge of calling the dtors of singleton objects.
201 base::AtExitManager exit_manager; 203 base::AtExitManager exit_manager;
202 204
203 base::i18n::InitializeICU(); 205 base::i18n::InitializeICU();
204 206
205 return DemoMain(); 207 return DemoMain();
206 } 208 }
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_browser_main_parts.cc ('k') | ui/aura/env.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698