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

Side by Side Diff: mojo/examples/sample_app/sample_app.cc

Issue 131153007: Send size to NativeViewportClient::OnCreated instead of GLES2Client::DidCreateContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix TODO Created 6 years, 11 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 "mojo/examples/sample_app/gles2_client_impl.h" 8 #include "mojo/examples/sample_app/gles2_client_impl.h"
9 #include "mojo/public/bindings/lib/remote_ptr.h" 9 #include "mojo/public/bindings/lib/remote_ptr.h"
10 #include "mojo/public/environment/environment.h" 10 #include "mojo/public/environment/environment.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 : viewport_(viewport_handle.Pass(), this) { 50 : viewport_(viewport_handle.Pass(), this) {
51 viewport_->Open(); 51 viewport_->Open();
52 52
53 MessagePipe pipe; 53 MessagePipe pipe;
54 gles2_client_.reset(new GLES2ClientImpl(pipe.handle0.Pass())); 54 gles2_client_.reset(new GLES2ClientImpl(pipe.handle0.Pass()));
55 viewport_->CreateGLES2Context(pipe.handle1.Pass()); 55 viewport_->CreateGLES2Context(pipe.handle1.Pass());
56 } 56 }
57 57
58 virtual ~NativeViewportClientImpl() {} 58 virtual ~NativeViewportClientImpl() {}
59 59
60 virtual void OnCreated() MOJO_OVERRIDE { 60 virtual void OnCreated(uint32_t width, uint32_t height) MOJO_OVERRIDE {
61 gles2_client_->SetSize(gfx::Size(width, height));
61 } 62 }
62 63
63 virtual void OnDestroyed() MOJO_OVERRIDE { 64 virtual void OnDestroyed() MOJO_OVERRIDE {
64 RunLoop::current()->Quit(); 65 RunLoop::current()->Quit();
65 } 66 }
66 67
67 virtual void OnEvent(const Event& event) MOJO_OVERRIDE { 68 virtual void OnEvent(const Event& event) MOJO_OVERRIDE {
68 if (!event.location().is_null()) { 69 if (!event.location().is_null()) {
69 gles2_client_->HandleInputEvent(event); 70 gles2_client_->HandleInputEvent(event);
70 viewport_->AckEvent(event); 71 viewport_->AckEvent(event);
(...skipping 16 matching lines...) Expand all
87 mojo::Environment env; 88 mojo::Environment env;
88 mojo::RunLoop loop; 89 mojo::RunLoop loop;
89 mojo::GLES2Initializer gles2; 90 mojo::GLES2Initializer gles2;
90 91
91 mojo::examples::SampleApp app( 92 mojo::examples::SampleApp app(
92 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); 93 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass());
93 loop.Run(); 94 loop.Run();
94 95
95 return MOJO_RESULT_OK; 96 return MOJO_RESULT_OK;
96 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698