Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "ui/aura/env.h" | 5 #include "ui/aura/env.h" |
| 6 #include "ui/aura/env_observer.h" | 6 #include "ui/aura/env_observer.h" |
| 7 #include "ui/aura/single_monitor_manager.h" | 7 #include "ui/aura/single_monitor_manager.h" |
| 8 #include "ui/aura/root_window_host.h" | 8 #include "ui/aura/root_window_host.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/gfx/compositor/compositor.h" | |
| 10 | 11 |
| 11 namespace aura { | 12 namespace aura { |
| 12 | 13 |
| 13 // static | 14 // static |
| 14 Env* Env::instance_ = NULL; | 15 Env* Env::instance_ = NULL; |
| 15 | 16 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
| 17 // Env, public: | 18 // Env, public: |
| 18 | 19 |
| 19 Env::Env() | 20 Env::Env() |
| 20 : mouse_button_flags_(0), | 21 : mouse_button_flags_(0), |
| 21 stacking_client_(NULL), | 22 stacking_client_(NULL), |
| 22 monitor_manager_(NULL) | 23 monitor_manager_(NULL) |
| 23 { | 24 { |
| 24 SetMonitorManager(new internal::SingleMonitorManager()); | 25 SetMonitorManager(new internal::SingleMonitorManager()); |
| 25 #if !defined(OS_MACOSX) | 26 #if !defined(OS_MACOSX) |
| 26 dispatcher_.reset(CreateDispatcher()); | 27 dispatcher_.reset(CreateDispatcher()); |
| 27 #endif | 28 #endif |
| 29 ui::Compositor::Initialize(false); | |
| 28 } | 30 } |
| 29 | 31 |
| 30 Env::~Env() {} | 32 Env::~Env() { |
| 33 ui::Compositor::Terminate(); | |
| 34 } | |
| 31 | 35 |
| 32 // static | 36 // static |
| 33 Env* Env::GetInstance() { | 37 Env* Env::GetInstance() { |
| 34 if (!instance_) | 38 if (!instance_) |
| 35 instance_ = new Env; | 39 instance_ = new Env; |
| 36 return instance_; | 40 return instance_; |
| 37 } | 41 } |
| 38 | 42 |
| 39 // static | 43 // static |
| 40 void Env::DeleteInstance() { | 44 void Env::DeleteInstance() { |
|
piman
2012/03/20 00:31:37
Just to confirm, where is this called from? It nee
oshima
2012/03/20 02:29:58
This is called in PostMessageLoopRun, which may be
piman
2012/03/20 04:45:46
Ok, this is fine then, according to http://src.chr
oshima
2012/03/20 16:31:13
Let me clarify. Do you want to count # of current
| |
| 41 delete instance_; | 45 delete instance_; |
| 42 instance_ = NULL; | 46 instance_ = NULL; |
| 43 } | 47 } |
| 44 | 48 |
| 45 void Env::AddObserver(EnvObserver* observer) { | 49 void Env::AddObserver(EnvObserver* observer) { |
| 46 observers_.AddObserver(observer); | 50 observers_.AddObserver(observer); |
| 47 } | 51 } |
| 48 | 52 |
| 49 void Env::RemoveObserver(EnvObserver* observer) { | 53 void Env::RemoveObserver(EnvObserver* observer) { |
| 50 observers_.RemoveObserver(observer); | 54 observers_.RemoveObserver(observer); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 61 #endif | 65 #endif |
| 62 | 66 |
| 63 //////////////////////////////////////////////////////////////////////////////// | 67 //////////////////////////////////////////////////////////////////////////////// |
| 64 // Env, private: | 68 // Env, private: |
| 65 | 69 |
| 66 void Env::NotifyWindowInitialized(Window* window) { | 70 void Env::NotifyWindowInitialized(Window* window) { |
| 67 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window)); | 71 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window)); |
| 68 } | 72 } |
| 69 | 73 |
| 70 } // namespace aura | 74 } // namespace aura |
| OLD | NEW |