| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "mojo/aura/window_tree_host_mojo.h" | 5 #include "mojo/aura/window_tree_host_mojo.h" |
| 6 | 6 |
| 7 #include "mojo/aura/context_factory_mojo.h" | 7 #include "mojo/aura/context_factory_mojo.h" |
| 8 #include "mojo/public/c/gles2/gles2.h" | 8 #include "mojo/public/c/gles2/gles2.h" |
| 9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" | 9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" |
| 10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 bounds_(bounds) { | 33 bounds_(bounds) { |
| 34 native_viewport_.set_client(this); | 34 native_viewport_.set_client(this); |
| 35 native_viewport_->Create(Rect::From(bounds)); | 35 native_viewport_->Create(Rect::From(bounds)); |
| 36 | 36 |
| 37 MessagePipe pipe; | 37 MessagePipe pipe; |
| 38 native_viewport_->CreateGLES2Context( | 38 native_viewport_->CreateGLES2Context( |
| 39 MakeRequest<CommandBuffer>(pipe.handle0.Pass())); | 39 MakeRequest<CommandBuffer>(pipe.handle0.Pass())); |
| 40 | 40 |
| 41 // The ContextFactory must exist before any Compositors are created. | 41 // The ContextFactory must exist before any Compositors are created. |
| 42 if (context_factory_) { | 42 if (context_factory_) { |
| 43 ui::ContextFactory::SetInstance(NULL); | |
| 44 delete context_factory_; | 43 delete context_factory_; |
| 45 context_factory_ = NULL; | 44 context_factory_ = NULL; |
| 46 } | 45 } |
| 47 context_factory_ = new ContextFactoryMojo(pipe.handle1.Pass()); | 46 context_factory_ = new ContextFactoryMojo(pipe.handle1.Pass()); |
| 48 ui::ContextFactory::SetInstance(context_factory_); | |
| 49 aura::Env::GetInstance()->set_context_factory(context_factory_); | 47 aura::Env::GetInstance()->set_context_factory(context_factory_); |
| 50 CHECK(context_factory_) << "No GL bindings."; | 48 CHECK(context_factory_) << "No GL bindings."; |
| 51 } | 49 } |
| 52 | 50 |
| 53 WindowTreeHostMojo::~WindowTreeHostMojo() { | 51 WindowTreeHostMojo::~WindowTreeHostMojo() { |
| 54 DestroyCompositor(); | 52 DestroyCompositor(); |
| 55 DestroyDispatcher(); | 53 DestroyDispatcher(); |
| 56 } | 54 } |
| 57 | 55 |
| 58 //////////////////////////////////////////////////////////////////////////////// | 56 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 event->flags, event->key_data->is_char); | 164 event->flags, event->key_data->is_char); |
| 167 SendEventToProcessor(&ev); | 165 SendEventToProcessor(&ev); |
| 168 break; | 166 break; |
| 169 } | 167 } |
| 170 // TODO(beng): touch, etc. | 168 // TODO(beng): touch, etc. |
| 171 } | 169 } |
| 172 callback.Run(); | 170 callback.Run(); |
| 173 }; | 171 }; |
| 174 | 172 |
| 175 } // namespace mojo | 173 } // namespace mojo |
| OLD | NEW |