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

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

Powered by Google App Engine
This is Rietveld 408576698