| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
| 8 #include "mojo/common/tracing_impl.h" | 8 #include "mojo/common/tracing_impl.h" |
| 9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
| 10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 public mojo::InterfaceFactory<Gpu> { | 27 public mojo::InterfaceFactory<Gpu> { |
| 28 public: | 28 public: |
| 29 NativeViewportAppDelegate() : is_headless_(false) {} | 29 NativeViewportAppDelegate() : is_headless_(false) {} |
| 30 ~NativeViewportAppDelegate() override {} | 30 ~NativeViewportAppDelegate() override {} |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 // mojo::ApplicationDelegate implementation. | 33 // mojo::ApplicationDelegate implementation. |
| 34 void Initialize(mojo::ApplicationImpl* application) override { | 34 void Initialize(mojo::ApplicationImpl* application) override { |
| 35 app_ = application; | 35 app_ = application; |
| 36 | 36 |
| 37 mojo::TracingImpl::Create(application); | 37 tracing_.Initialize(app_); |
| 38 | 38 |
| 39 if (app_->HasArg(mojo::kUseTestConfig)) | 39 if (app_->HasArg(mojo::kUseTestConfig)) |
| 40 gfx::GLSurface::InitializeOneOffForTests(); | 40 gfx::GLSurface::InitializeOneOffForTests(); |
| 41 else if (app_->HasArg(mojo::kUseOSMesa)) | 41 else if (app_->HasArg(mojo::kUseOSMesa)) |
| 42 gfx::GLSurface::InitializeOneOff(gfx::kGLImplementationOSMesaGL); | 42 gfx::GLSurface::InitializeOneOff(gfx::kGLImplementationOSMesaGL); |
| 43 else | 43 else |
| 44 gfx::GLSurface::InitializeOneOff(); | 44 gfx::GLSurface::InitializeOneOff(); |
| 45 | 45 |
| 46 is_headless_ = app_->HasArg(mojo::kUseHeadlessConfig); | 46 is_headless_ = app_->HasArg(mojo::kUseHeadlessConfig); |
| 47 } | 47 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 62 void Create(ApplicationConnection* connection, | 62 void Create(ApplicationConnection* connection, |
| 63 mojo::InterfaceRequest<Gpu> request) override { | 63 mojo::InterfaceRequest<Gpu> request) override { |
| 64 if (!gpu_state_.get()) | 64 if (!gpu_state_.get()) |
| 65 gpu_state_ = new gles2::GpuImpl::State; | 65 gpu_state_ = new gles2::GpuImpl::State; |
| 66 new gles2::GpuImpl(request.Pass(), gpu_state_); | 66 new gles2::GpuImpl(request.Pass(), gpu_state_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 mojo::ApplicationImpl* app_; | 69 mojo::ApplicationImpl* app_; |
| 70 scoped_refptr<gles2::GpuImpl::State> gpu_state_; | 70 scoped_refptr<gles2::GpuImpl::State> gpu_state_; |
| 71 bool is_headless_; | 71 bool is_headless_; |
| 72 mojo::TracingImpl tracing_; |
| 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate); |
| 73 }; | 75 }; |
| 74 } | 76 } |
| 75 | 77 |
| 76 MojoResult MojoMain(MojoHandle shell_handle) { | 78 MojoResult MojoMain(MojoHandle shell_handle) { |
| 77 mojo::ApplicationRunnerChromium runner( | 79 mojo::ApplicationRunnerChromium runner( |
| 78 new native_viewport::NativeViewportAppDelegate); | 80 new native_viewport::NativeViewportAppDelegate); |
| 79 runner.set_message_loop_type(base::MessageLoop::TYPE_UI); | 81 runner.set_message_loop_type(base::MessageLoop::TYPE_UI); |
| 80 return runner.Run(shell_handle); | 82 return runner.Run(shell_handle); |
| 81 } | 83 } |
| OLD | NEW |