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

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

Issue 1293013002: aura: Require explicit ownership of the Env instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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
« no previous file with comments | « ui/aura/bench/bench_main.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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/i18n/icu_util.h" 7 #include "base/i18n/icu_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/power_monitor/power_monitor.h" 10 #include "base/power_monitor/power_monitor.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 scoped_ptr<ui::InProcessContextFactory> context_factory( 137 scoped_ptr<ui::InProcessContextFactory> context_factory(
138 new ui::InProcessContextFactory(context_factory_for_test, nullptr)); 138 new ui::InProcessContextFactory(context_factory_for_test, nullptr));
139 context_factory->set_use_test_surface(false); 139 context_factory->set_use_test_surface(false);
140 140
141 // Create the message-loop here before creating the root window. 141 // Create the message-loop here before creating the root window.
142 base::MessageLoopForUI message_loop; 142 base::MessageLoopForUI message_loop;
143 143
144 base::PowerMonitor power_monitor(make_scoped_ptr( 144 base::PowerMonitor power_monitor(make_scoped_ptr(
145 new base::PowerMonitorDeviceSource)); 145 new base::PowerMonitorDeviceSource));
146 146
147 aura::Env::CreateInstance(true); 147 scoped_ptr<aura::Env> env = aura::Env::CreateInstance();
148 aura::Env::GetInstance()->set_context_factory(context_factory.get()); 148 env->set_context_factory(context_factory.get());
149 scoped_ptr<aura::TestScreen> test_screen( 149 scoped_ptr<aura::TestScreen> test_screen(
150 aura::TestScreen::Create(gfx::Size())); 150 aura::TestScreen::Create(gfx::Size()));
151 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get()); 151 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get());
152 scoped_ptr<aura::WindowTreeHost> host( 152 scoped_ptr<aura::WindowTreeHost> host(
153 test_screen->CreateHostForPrimaryDisplay()); 153 test_screen->CreateHostForPrimaryDisplay());
154 scoped_ptr<DemoWindowTreeClient> window_tree_client( 154 scoped_ptr<DemoWindowTreeClient> window_tree_client(
155 new DemoWindowTreeClient(host->window())); 155 new DemoWindowTreeClient(host->window()));
156 aura::test::TestFocusClient focus_client; 156 aura::test::TestFocusClient focus_client;
157 aura::client::SetFocusClient(host->window(), &focus_client); 157 aura::client::SetFocusClient(host->window(), &focus_client);
158 158
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 int main(int argc, char** argv) { 195 int main(int argc, char** argv) {
196 base::CommandLine::Init(argc, argv); 196 base::CommandLine::Init(argc, argv);
197 197
198 // The exit manager is in charge of calling the dtors of singleton objects. 198 // The exit manager is in charge of calling the dtors of singleton objects.
199 base::AtExitManager exit_manager; 199 base::AtExitManager exit_manager;
200 200
201 base::i18n::InitializeICU(); 201 base::i18n::InitializeICU();
202 202
203 return DemoMain(); 203 return DemoMain();
204 } 204 }
OLDNEW
« no previous file with comments | « ui/aura/bench/bench_main.cc ('k') | ui/aura/env.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698