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

Side by Side Diff: mojo/examples/compositor_app/compositor_app.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 <stdio.h> 5 #include <stdio.h>
6 #include <string> 6 #include <string>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "mojo/examples/compositor_app/compositor_host.h" 9 #include "mojo/examples/compositor_app/compositor_host.h"
10 #include "mojo/public/cpp/application/application_delegate.h" 10 #include "mojo/public/cpp/application/application_delegate.h"
(...skipping 21 matching lines...) Expand all
32 32
33 MessagePipe pipe; 33 MessagePipe pipe;
34 viewport_->CreateGLES2Context( 34 viewport_->CreateGLES2Context(
35 MakeRequest<CommandBuffer>(pipe.handle0.Pass())); 35 MakeRequest<CommandBuffer>(pipe.handle0.Pass()));
36 host_.reset(new CompositorHost(pipe.handle1.Pass())); 36 host_.reset(new CompositorHost(pipe.handle1.Pass()));
37 } 37 }
38 38
39 virtual void OnCreated() OVERRIDE { 39 virtual void OnCreated() OVERRIDE {
40 } 40 }
41 41
42 virtual void OnDestroyed() OVERRIDE { 42 virtual void OnDestroyed(const mojo::Callback<void()>& callback) OVERRIDE {
43 base::MessageLoop::current()->Quit(); 43 base::MessageLoop::current()->Quit();
44 callback.Run();
44 } 45 }
45 46
46 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE { 47 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE {
47 host_->SetSize(gfx::Size(bounds->width, bounds->height)); 48 host_->SetSize(gfx::Size(bounds->width, bounds->height));
48 } 49 }
49 50
50 virtual void OnEvent(EventPtr event, 51 virtual void OnEvent(EventPtr event,
51 const mojo::Callback<void()>& callback) OVERRIDE { 52 const mojo::Callback<void()>& callback) OVERRIDE {
52 callback.Run(); 53 callback.Run();
53 } 54 }
54 55
55 private: 56 private:
56 mojo::GLES2Initializer gles2; 57 mojo::GLES2Initializer gles2;
57 NativeViewportPtr viewport_; 58 NativeViewportPtr viewport_;
58 scoped_ptr<CompositorHost> host_; 59 scoped_ptr<CompositorHost> host_;
59 DISALLOW_COPY_AND_ASSIGN(SampleApp); 60 DISALLOW_COPY_AND_ASSIGN(SampleApp);
60 }; 61 };
61 62
62 } // namespace examples 63 } // namespace examples
63 64
64 // static 65 // static
65 ApplicationDelegate* ApplicationDelegate::Create() { 66 ApplicationDelegate* ApplicationDelegate::Create() {
66 return new examples::SampleApp(); 67 return new examples::SampleApp();
67 } 68 }
68 69
69 } // namespace mojo 70 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698