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

Side by Side Diff: mojo/services/view_manager/window_tree_host_impl.cc

Issue 372273004: Shutdown cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/services/view_manager/root_node_manager.h" 5 #include "mojo/services/view_manager/root_node_manager.h"
6 #include "mojo/services/view_manager/window_tree_host_impl.h" 6 #include "mojo/services/view_manager/window_tree_host_impl.h"
7 #include "mojo/public/c/gles2/gles2.h" 7 #include "mojo/public/c/gles2/gles2.h"
8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" 8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
9 #include "mojo/services/view_manager/context_factory_impl.h" 9 #include "mojo/services/view_manager/context_factory_impl.h"
10 #include "ui/aura/env.h" 10 #include "ui/aura/env.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 const gfx::Rect& requested_bounds) { 61 const gfx::Rect& requested_bounds) {
62 SetChildBoundsDirect(child, gfx::Rect(requested_bounds.size())); 62 SetChildBoundsDirect(child, gfx::Rect(requested_bounds.size()));
63 } 63 }
64 64
65 //////////////////////////////////////////////////////////////////////////////// 65 ////////////////////////////////////////////////////////////////////////////////
66 // WindowTreeHostImpl, public: 66 // WindowTreeHostImpl, public:
67 67
68 WindowTreeHostImpl::WindowTreeHostImpl( 68 WindowTreeHostImpl::WindowTreeHostImpl(
69 NativeViewportPtr viewport, 69 NativeViewportPtr viewport,
70 const gfx::Rect& bounds, 70 const gfx::Rect& bounds,
71 const base::Callback<void()>& compositor_created_callback) 71 const Callback<void()>& compositor_created_callback,
72 const Callback<void()>& native_viewport_closed_callback)
72 : native_viewport_(viewport.Pass()), 73 : native_viewport_(viewport.Pass()),
73 compositor_created_callback_(compositor_created_callback), 74 compositor_created_callback_(compositor_created_callback),
75 native_viewport_closed_callback_(native_viewport_closed_callback),
74 bounds_(bounds) { 76 bounds_(bounds) {
75 native_viewport_.set_client(this); 77 native_viewport_.set_client(this);
76 native_viewport_->Create(Rect::From(bounds)); 78 native_viewport_->Create(Rect::From(bounds));
77 79
78 MessagePipe pipe; 80 MessagePipe pipe;
79 native_viewport_->CreateGLES2Context( 81 native_viewport_->CreateGLES2Context(
80 MakeRequest<CommandBuffer>(pipe.handle0.Pass())); 82 MakeRequest<CommandBuffer>(pipe.handle0.Pass()));
81 83
82 // The ContextFactory must exist before any Compositors are created. 84 // The ContextFactory must exist before any Compositors are created.
83 if (context_factory_) { 85 if (context_factory_) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void WindowTreeHostImpl::OnCreated() { 173 void WindowTreeHostImpl::OnCreated() {
172 CreateCompositor(GetAcceleratedWidget()); 174 CreateCompositor(GetAcceleratedWidget());
173 compositor_created_callback_.Run(); 175 compositor_created_callback_.Run();
174 } 176 }
175 177
176 void WindowTreeHostImpl::OnBoundsChanged(RectPtr bounds) { 178 void WindowTreeHostImpl::OnBoundsChanged(RectPtr bounds) {
177 bounds_ = bounds.To<gfx::Rect>(); 179 bounds_ = bounds.To<gfx::Rect>();
178 OnHostResized(bounds_.size()); 180 OnHostResized(bounds_.size());
179 } 181 }
180 182
181 void WindowTreeHostImpl::OnDestroyed() { 183 void WindowTreeHostImpl::OnDestroyed(const mojo::Callback<void()>& callback) {
182 base::MessageLoop::current()->Quit(); 184 DestroyCompositor();
185 native_viewport_closed_callback_.Run();
186 //base::MessageLoop::current()->Quit();
sky 2014/07/10 22:54:29 remove commented out code.
187 callback.Run();
183 } 188 }
184 189
185 void WindowTreeHostImpl::OnEvent(EventPtr event, 190 void WindowTreeHostImpl::OnEvent(EventPtr event,
186 const mojo::Callback<void()>& callback) { 191 const mojo::Callback<void()>& callback) {
187 switch (event->action) { 192 switch (event->action) {
188 case ui::ET_MOUSE_PRESSED: 193 case ui::ET_MOUSE_PRESSED:
189 case ui::ET_MOUSE_DRAGGED: 194 case ui::ET_MOUSE_DRAGGED:
190 case ui::ET_MOUSE_RELEASED: 195 case ui::ET_MOUSE_RELEASED:
191 case ui::ET_MOUSE_MOVED: 196 case ui::ET_MOUSE_MOVED:
192 case ui::ET_MOUSE_ENTERED: 197 case ui::ET_MOUSE_ENTERED:
(...skipping 22 matching lines...) Expand all
215 break; 220 break;
216 } 221 }
217 // TODO(beng): touch, etc. 222 // TODO(beng): touch, etc.
218 } 223 }
219 callback.Run(); 224 callback.Run();
220 }; 225 };
221 226
222 } // namespace service 227 } // namespace service
223 } // namespace view_manager 228 } // namespace view_manager
224 } // namespace mojo 229 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698