| OLD | NEW |
| 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/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 virtual void OnEvent(EventPtr event, | 49 virtual void OnEvent(EventPtr event, |
| 50 const mojo::Callback<void()>& callback) override { | 50 const mojo::Callback<void()>& callback) override { |
| 51 callback.Run(); | 51 callback.Run(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 void OnCreatedNativeViewport(uint64_t native_viewport_id) { | 55 void OnCreatedNativeViewport(uint64_t native_viewport_id) { |
| 56 CommandBufferPtr cb; | 56 CommandBufferPtr cb; |
| 57 // TODO(jamesr): Output to a surface instead. | 57 // TODO(jamesr): Output to a surface instead. |
| 58 gpu_service_->CreateOnscreenGLES2Context( | 58 gpu_service_->CreateOnscreenGLES2Context( |
| 59 native_viewport_id, Size::From(gfx::Size(800, 600)), Get(&cb)); | 59 native_viewport_id, Size::From(gfx::Size(800, 600)), GetProxy(&cb)); |
| 60 host_.reset(new CompositorHost(cb.PassMessagePipe())); | 60 host_.reset(new CompositorHost(cb.PassMessagePipe())); |
| 61 } | 61 } |
| 62 | 62 |
| 63 | 63 |
| 64 NativeViewportPtr viewport_; | 64 NativeViewportPtr viewport_; |
| 65 GpuPtr gpu_service_; | 65 GpuPtr gpu_service_; |
| 66 scoped_ptr<CompositorHost> host_; | 66 scoped_ptr<CompositorHost> host_; |
| 67 base::WeakPtrFactory<SampleApp> weak_factory_; | 67 base::WeakPtrFactory<SampleApp> weak_factory_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(SampleApp); | 69 DISALLOW_COPY_AND_ASSIGN(SampleApp); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace examples | 72 } // namespace examples |
| 73 } // namespace mojo | 73 } // namespace mojo |
| 74 | 74 |
| 75 MojoResult MojoMain(MojoHandle shell_handle) { | 75 MojoResult MojoMain(MojoHandle shell_handle) { |
| 76 mojo::ApplicationRunnerChromium runner(new mojo::examples::SampleApp); | 76 mojo::ApplicationRunnerChromium runner(new mojo::examples::SampleApp); |
| 77 return runner.Run(shell_handle); | 77 return runner.Run(shell_handle); |
| 78 } | 78 } |
| OLD | NEW |