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

Side by Side Diff: ui/views/examples/examples_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 | « ui/aura/test/run_all_unittests.cc ('k') | ui/views/mus/BUILD.gn » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/files/file_path.h" 9 #include "base/files/file_path.h"
8 #include "base/i18n/icu_util.h" 10 #include "base/i18n/icu_util.h"
9 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
10 #include "base/path_service.h" 12 #include "base/path_service.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 "base/run_loop.h" 15 #include "base/run_loop.h"
14 #include "build/build_config.h" 16 #include "build/build_config.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); 76 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
75 77
76 base::PowerMonitor power_monitor(make_scoped_ptr( 78 base::PowerMonitor power_monitor(make_scoped_ptr(
77 new base::PowerMonitorDeviceSource)); 79 new base::PowerMonitorDeviceSource));
78 80
79 #if defined(OS_WIN) 81 #if defined(OS_WIN)
80 gfx::win::MaybeInitializeDirectWrite(); 82 gfx::win::MaybeInitializeDirectWrite();
81 #endif 83 #endif
82 84
83 #if defined(USE_AURA) 85 #if defined(USE_AURA)
84 aura::Env::CreateInstance(true); 86 std::unique_ptr<aura::Env> env = aura::Env::CreateInstance();
85 aura::Env::GetInstance()->set_context_factory(context_factory.get()); 87 aura::Env::GetInstance()->set_context_factory(context_factory.get());
86 #endif 88 #endif
87 ui::InitializeInputMethodForTesting(); 89 ui::InitializeInputMethodForTesting();
88 90
89 { 91 {
90 views::DesktopTestViewsDelegate views_delegate; 92 views::DesktopTestViewsDelegate views_delegate;
91 #if defined(USE_AURA) 93 #if defined(USE_AURA)
92 wm::WMState wm_state; 94 wm::WMState wm_state;
93 #endif 95 #endif
94 #if !defined(OS_CHROMEOS) && defined(USE_AURA) 96 #if !defined(OS_CHROMEOS) && defined(USE_AURA)
95 scoped_ptr<gfx::Screen> desktop_screen(views::CreateDesktopScreen()); 97 scoped_ptr<gfx::Screen> desktop_screen(views::CreateDesktopScreen());
96 gfx::Screen::SetScreenInstance(desktop_screen.get()); 98 gfx::Screen::SetScreenInstance(desktop_screen.get());
97 #endif 99 #endif
98 100
99 views::examples::ShowExamplesWindow( 101 views::examples::ShowExamplesWindow(
100 views::examples::QUIT_ON_CLOSE, nullptr, 102 views::examples::QUIT_ON_CLOSE, nullptr,
101 scoped_ptr<ScopedVector<views::examples::ExampleBase>>()); 103 scoped_ptr<ScopedVector<views::examples::ExampleBase>>());
102 104
103 base::RunLoop().Run(); 105 base::RunLoop().Run();
104 106
105 ui::ResourceBundle::CleanupSharedInstance(); 107 ui::ResourceBundle::CleanupSharedInstance();
106 } 108 }
107 109
108 ui::ShutdownInputMethod(); 110 ui::ShutdownInputMethod();
109 111
110 #if defined(USE_AURA) 112 #if defined(USE_AURA)
111 aura::Env::DeleteInstance(); 113 env.reset();
112 #endif 114 #endif
113 115
114 return 0; 116 return 0;
115 } 117 }
OLDNEW
« no previous file with comments | « ui/aura/test/run_all_unittests.cc ('k') | ui/views/mus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698