summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-22 21:47:58 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-22 21:47:58 +0000
commitfa69f2b688dd5fcefe3484aaa9b7d99175bc1bb9 (patch)
tree1d9c539da5aab9ef57883d5f871d91bffdbd9f6b /ash
parent15b4290d997471abce904d693291808e8205ddd3 (diff)
downloadchromium_src-fa69f2b688dd5fcefe3484aaa9b7d99175bc1bb9.zip
chromium_src-fa69f2b688dd5fcefe3484aaa9b7d99175bc1bb9.tar.gz
chromium_src-fa69f2b688dd5fcefe3484aaa9b7d99175bc1bb9.tar.bz2
Makes Env contain a ContextFactory
This way when creating the Compositor we can supply the ContextFactory from the thread local Env to it. This is part of making aura thread safe. BUG=none TEST=none R=ben@chromium.org Review URL: https://codereview.chromium.org/296053009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/shell.cc4
-rw-r--r--ash/shell/content_client/shell_browser_main_parts.cc2
-rw-r--r--ash/shell/window_watcher_unittest.cc2
-rw-r--r--ash/shell_init_params.cc8
-rw-r--r--ash/shell_init_params.h6
-rw-r--r--ash/test/ash_test_helper.cc4
6 files changed, 19 insertions, 7 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index d2322d8..c0a1765 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -843,10 +843,8 @@ void Shell::Init(const ShellInitParams& init_params) {
// Shelf, and WallPaper could be created by the factory.
views::FocusManagerFactory::Install(new AshFocusManagerFactory);
- // Env creates the compositor. Historically it seems to have been implicitly
- // initialized first by the ActivationController, but now that FocusController
- // no longer does this we need to do it explicitly.
aura::Env::CreateInstance(true);
+ aura::Env::GetInstance()->set_context_factory(init_params.context_factory);
// The WindowModalityController needs to be at the front of the input event
// pretarget handler list to ensure that it processes input events when modal
diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc
index 8accc93..cb84b46 100644
--- a/ash/shell/content_client/shell_browser_main_parts.cc
+++ b/ash/shell/content_client/shell_browser_main_parts.cc
@@ -18,6 +18,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
+#include "content/public/browser/context_factory.h"
#include "content/public/common/content_switches.h"
#include "content/shell/browser/shell_browser_context.h"
#include "content/shell/browser/shell_net_log.h"
@@ -124,6 +125,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
ash::ShellInitParams init_params;
init_params.delegate = delegate_;
+ init_params.context_factory = content::GetContextFactory();
ash::Shell::CreateInstance(init_params);
delegate_->set_browser_context(browser_context_.get());
ash::Shell::GetInstance()->CreateShelf();
diff --git a/ash/shell/window_watcher_unittest.cc b/ash/shell/window_watcher_unittest.cc
index dd5ea40..c3b5dcf 100644
--- a/ash/shell/window_watcher_unittest.cc
+++ b/ash/shell/window_watcher_unittest.cc
@@ -10,6 +10,7 @@
#include "ash/shell_init_params.h"
#include "ash/system/user/login_status.h"
#include "ash/test/ash_test_base.h"
+#include "ui/aura/env.h"
#include "ui/aura/window_tree_host.h"
namespace ash {
@@ -25,6 +26,7 @@ TEST_F(WindowWatcherTest, ShellDeleteInstance) {
shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl;
ash::ShellInitParams init_params;
+ init_params.context_factory = aura::Env::GetInstance()->context_factory();
init_params.delegate = delegate;
Shell::CreateInstance(init_params);
Shell::GetPrimaryRootWindow()->GetHost()->Show();
diff --git a/ash/shell_init_params.cc b/ash/shell_init_params.cc
index 87e5be8..bba57c6 100644
--- a/ash/shell_init_params.cc
+++ b/ash/shell_init_params.cc
@@ -8,11 +8,13 @@
namespace ash {
+ShellInitParams::ShellInitParams()
+ : delegate(NULL),
+ context_factory(NULL)
#if defined(OS_WIN)
-ShellInitParams::ShellInitParams() : delegate(NULL), remote_hwnd(NULL) {}
-#else
-ShellInitParams::ShellInitParams() : delegate(NULL) {}
+ , remote_hwnd(NULL)
#endif
+ {}
ShellInitParams::~ShellInitParams() {}
diff --git a/ash/shell_init_params.h b/ash/shell_init_params.h
index 52b894e..9a681fae 100644
--- a/ash/shell_init_params.h
+++ b/ash/shell_init_params.h
@@ -13,6 +13,10 @@
#include "ash/ash_export.h"
+namespace ui {
+class ContextFactory;
+}
+
namespace ash {
class ShellDelegate;
@@ -23,6 +27,8 @@ struct ASH_EXPORT ShellInitParams {
ShellDelegate* delegate;
+ ui::ContextFactory* context_factory;
+
#if defined(OS_WIN)
HWND remote_hwnd;
#endif
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc
index 3dd9455..ceb2910 100644
--- a/ash/test/ash_test_helper.cc
+++ b/ash/test/ash_test_helper.cc
@@ -65,7 +65,8 @@ void AshTestHelper::SetUp(bool start_session) {
ui::InitializeInputMethodForTesting();
bool enable_pixel_output = false;
- ui::InitializeContextFactoryForTests(enable_pixel_output);
+ ui::ContextFactory* context_factory =
+ ui::InitializeContextFactoryForTests(enable_pixel_output);
// Creates Shell and hook with Desktop.
if (!test_shell_delegate_)
@@ -87,6 +88,7 @@ void AshTestHelper::SetUp(bool start_session) {
#endif
ShellInitParams init_params;
init_params.delegate = test_shell_delegate_;
+ init_params.context_factory = context_factory;
ash::Shell::CreateInstance(init_params);
aura::test::EnvTestHelper(aura::Env::GetInstance()).SetInputStateLookup(
scoped_ptr<aura::InputStateLookup>());