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

Side by Side Diff: mojo/services/native_viewport/main.cc

Issue 623573002: Mojo: Convert the remaining OVERRIDEs to override in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
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/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
6 #include "gpu/command_buffer/service/mailbox_manager.h" 7 #include "gpu/command_buffer/service/mailbox_manager.h"
7 #include "mojo/application/application_runner_chromium.h" 8 #include "mojo/application/application_runner_chromium.h"
8 #include "mojo/public/c/system/main.h" 9 #include "mojo/public/c/system/main.h"
9 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/application/application_delegate.h" 11 #include "mojo/public/cpp/application/application_delegate.h"
11 #include "mojo/public/cpp/application/interface_factory_impl.h" 12 #include "mojo/public/cpp/application/interface_factory_impl.h"
12 #include "mojo/services/native_viewport/gpu_impl.h" 13 #include "mojo/services/native_viewport/gpu_impl.h"
13 #include "mojo/services/native_viewport/native_viewport_impl.h" 14 #include "mojo/services/native_viewport/native_viewport_impl.h"
14 #include "ui/gl/gl_share_group.h" 15 #include "ui/gl/gl_share_group.h"
(...skipping 15 matching lines...) Expand all
30 is_initialized_(false) {} 31 is_initialized_(false) {}
31 virtual ~NativeViewportAppDelegate() {} 32 virtual ~NativeViewportAppDelegate() {}
32 33
33 private: 34 private:
34 class NativeViewportConfigImpl : public InterfaceImpl<NativeViewportConfig> { 35 class NativeViewportConfigImpl : public InterfaceImpl<NativeViewportConfig> {
35 public: 36 public:
36 NativeViewportConfigImpl(NativeViewportAppDelegate* app_delegate) 37 NativeViewportConfigImpl(NativeViewportAppDelegate* app_delegate)
37 : app_delegate_(app_delegate) {} 38 : app_delegate_(app_delegate) {}
38 39
39 virtual void UseTestConfig( 40 virtual void UseTestConfig(
40 const Callback<void()>& callback) OVERRIDE { 41 const Callback<void()>& callback) override {
41 app_delegate_->is_test_ = true; 42 app_delegate_->is_test_ = true;
42 callback.Run(); 43 callback.Run();
43 } 44 }
44 45
45 virtual void UseHeadlessConfig( 46 virtual void UseHeadlessConfig(
46 const Callback<void()>& callback) OVERRIDE { 47 const Callback<void()>& callback) override {
47 app_delegate_->is_headless_ = true; 48 app_delegate_->is_headless_ = true;
48 callback.Run(); 49 callback.Run();
49 } 50 }
50 51
51 private: 52 private:
52 NativeViewportAppDelegate* app_delegate_; 53 NativeViewportAppDelegate* app_delegate_;
53 }; 54 };
54 55
55 // ApplicationDelegate implementation. 56 // ApplicationDelegate implementation.
56 virtual void Initialize(ApplicationImpl* application) OVERRIDE { 57 virtual void Initialize(ApplicationImpl* application) override {
57 app_ = application; 58 app_ = application;
58 } 59 }
59 60
60 virtual bool ConfigureIncomingConnection( 61 virtual bool ConfigureIncomingConnection(
61 mojo::ApplicationConnection* connection) OVERRIDE { 62 mojo::ApplicationConnection* connection) override {
62 connection->AddService<NativeViewport>(this); 63 connection->AddService<NativeViewport>(this);
63 connection->AddService<Gpu>(this); 64 connection->AddService<Gpu>(this);
64 connection->AddService<NativeViewportConfig>(this); 65 connection->AddService<NativeViewportConfig>(this);
65 return true; 66 return true;
66 } 67 }
67 68
68 // InterfaceFactory<NativeViewport> implementation. 69 // InterfaceFactory<NativeViewport> implementation.
69 virtual void Create(ApplicationConnection* connection, 70 virtual void Create(ApplicationConnection* connection,
70 InterfaceRequest<NativeViewport> request) OVERRIDE { 71 InterfaceRequest<NativeViewport> request) override {
71 #if !defined(COMPONENT_BUILD) 72 #if !defined(COMPONENT_BUILD)
72 if (!is_initialized_) { 73 if (!is_initialized_) {
73 if (is_test_) 74 if (is_test_)
74 gfx::GLSurface::InitializeOneOffForTests(); 75 gfx::GLSurface::InitializeOneOffForTests();
75 else 76 else
76 gfx::GLSurface::InitializeOneOff(); 77 gfx::GLSurface::InitializeOneOff();
77 is_initialized_ = true; 78 is_initialized_ = true;
78 } 79 }
79 #endif 80 #endif
80 BindToRequest(new NativeViewportImpl(app_, is_headless_), &request); 81 BindToRequest(new NativeViewportImpl(app_, is_headless_), &request);
81 } 82 }
82 83
83 // InterfaceFactory<Gpu> implementation. 84 // InterfaceFactory<Gpu> implementation.
84 virtual void Create(ApplicationConnection* connection, 85 virtual void Create(ApplicationConnection* connection,
85 InterfaceRequest<Gpu> request) OVERRIDE { 86 InterfaceRequest<Gpu> request) override {
86 BindToRequest(new GpuImpl(share_group_.get(), mailbox_manager_.get()), 87 BindToRequest(new GpuImpl(share_group_.get(), mailbox_manager_.get()),
87 &request); 88 &request);
88 } 89 }
89 90
90 // InterfaceFactory<NVTestConfig> implementation. 91 // InterfaceFactory<NVTestConfig> implementation.
91 virtual void Create(ApplicationConnection* connection, 92 virtual void Create(ApplicationConnection* connection,
92 InterfaceRequest<NativeViewportConfig> request) OVERRIDE { 93 InterfaceRequest<NativeViewportConfig> request) override {
93 BindToRequest(new NativeViewportConfigImpl(this), &request); 94 BindToRequest(new NativeViewportConfigImpl(this), &request);
94 } 95 }
95 96
96 ApplicationImpl* app_; 97 ApplicationImpl* app_;
97 scoped_refptr<gfx::GLShareGroup> share_group_; 98 scoped_refptr<gfx::GLShareGroup> share_group_;
98 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 99 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
99 bool is_test_; 100 bool is_test_;
100 bool is_headless_; 101 bool is_headless_;
101 bool is_initialized_; 102 bool is_initialized_;
102 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate); 103 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate);
103 }; 104 };
104 } 105 }
105 106
106 MojoResult MojoMain(MojoHandle shell_handle) { 107 MojoResult MojoMain(MojoHandle shell_handle) {
107 mojo::ApplicationRunnerChromium runner(new mojo::NativeViewportAppDelegate); 108 mojo::ApplicationRunnerChromium runner(new mojo::NativeViewportAppDelegate);
108 runner.set_message_loop_type(base::MessageLoop::TYPE_UI); 109 runner.set_message_loop_type(base::MessageLoop::TYPE_UI);
109 return runner.Run(shell_handle); 110 return runner.Run(shell_handle);
110 } 111 }
OLDNEW
« no previous file with comments | « mojo/services/native_viewport/gpu_impl.h ('k') | mojo/services/native_viewport/native_viewport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698