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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "components/gles2/gpu_impl.h" | 8 #include "components/gles2/gpu_impl.h" |
9 #include "components/native_viewport/native_viewport_impl.h" | 9 #include "components/native_viewport/native_viewport_impl.h" |
10 #include "components/native_viewport/public/cpp/args.h" | 10 #include "components/native_viewport/public/cpp/args.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 public: | 30 public: |
31 NativeViewportAppDelegate() : is_headless_(false) {} | 31 NativeViewportAppDelegate() : is_headless_(false) {} |
32 ~NativeViewportAppDelegate() override {} | 32 ~NativeViewportAppDelegate() override {} |
33 | 33 |
34 private: | 34 private: |
35 // mojo::ApplicationDelegate implementation. | 35 // mojo::ApplicationDelegate implementation. |
36 void Initialize(mojo::ApplicationImpl* application) override { | 36 void Initialize(mojo::ApplicationImpl* application) override { |
37 tracing_.Initialize(application); | 37 tracing_.Initialize(application); |
38 | 38 |
39 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 39 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
40 if (command_line->HasSwitch(mojo::kUseTestConfig)) | |
41 gfx::GLSurface::InitializeOneOffForTests(); | |
42 else | |
43 gfx::GLSurface::InitializeOneOff(); | |
44 | |
45 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); | 40 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); |
| 41 if (!is_headless_) { |
| 42 if (command_line->HasSwitch(mojo::kUseTestConfig)) |
| 43 gfx::GLSurface::InitializeOneOffForTests(); |
| 44 else |
| 45 gfx::GLSurface::InitializeOneOff(); |
| 46 } |
46 } | 47 } |
47 | 48 |
48 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 49 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
49 connection->AddService<NativeViewport>(this); | 50 connection->AddService<NativeViewport>(this); |
50 connection->AddService<Gpu>(this); | 51 connection->AddService<Gpu>(this); |
51 return true; | 52 return true; |
52 } | 53 } |
53 | 54 |
54 // mojo::InterfaceFactory<NativeViewport> implementation. | 55 // mojo::InterfaceFactory<NativeViewport> implementation. |
55 void Create(ApplicationConnection* connection, | 56 void Create(ApplicationConnection* connection, |
(...skipping 18 matching lines...) Expand all Loading... |
74 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate); | 75 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate); |
75 }; | 76 }; |
76 } | 77 } |
77 | 78 |
78 MojoResult MojoMain(MojoHandle shell_handle) { | 79 MojoResult MojoMain(MojoHandle shell_handle) { |
79 mojo::ApplicationRunnerChromium runner( | 80 mojo::ApplicationRunnerChromium runner( |
80 new native_viewport::NativeViewportAppDelegate); | 81 new native_viewport::NativeViewportAppDelegate); |
81 runner.set_message_loop_type(base::MessageLoop::TYPE_UI); | 82 runner.set_message_loop_type(base::MessageLoop::TYPE_UI); |
82 return runner.Run(shell_handle); | 83 return runner.Run(shell_handle); |
83 } | 84 } |
OLD | NEW |