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

Side by Side Diff: mojo/shell/context.cc

Issue 451753003: Mojo multiple command buffer support and sample (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better casts Created 6 years, 4 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
« no previous file with comments | « mojo/shell/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "mojo/shell/context.h" 5 #include "mojo/shell/context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "gpu/command_buffer/service/mailbox_manager.h"
14 #include "mojo/application_manager/application_loader.h" 15 #include "mojo/application_manager/application_loader.h"
15 #include "mojo/application_manager/application_manager.h" 16 #include "mojo/application_manager/application_manager.h"
16 #include "mojo/application_manager/background_shell_application_loader.h" 17 #include "mojo/application_manager/background_shell_application_loader.h"
17 #include "mojo/embedder/embedder.h" 18 #include "mojo/embedder/embedder.h"
18 #include "mojo/public/cpp/application/application_connection.h" 19 #include "mojo/public/cpp/application/application_connection.h"
19 #include "mojo/public/cpp/application/application_delegate.h" 20 #include "mojo/public/cpp/application/application_delegate.h"
20 #include "mojo/public/cpp/application/application_impl.h" 21 #include "mojo/public/cpp/application/application_impl.h"
22 #include "mojo/services/native_viewport/gpu_impl.h"
21 #include "mojo/services/native_viewport/native_viewport_impl.h" 23 #include "mojo/services/native_viewport/native_viewport_impl.h"
22 #include "mojo/shell/dynamic_application_loader.h" 24 #include "mojo/shell/dynamic_application_loader.h"
23 #include "mojo/shell/in_process_dynamic_service_runner.h" 25 #include "mojo/shell/in_process_dynamic_service_runner.h"
24 #include "mojo/shell/out_of_process_dynamic_service_runner.h" 26 #include "mojo/shell/out_of_process_dynamic_service_runner.h"
25 #include "mojo/shell/switches.h" 27 #include "mojo/shell/switches.h"
26 #include "mojo/shell/ui_application_loader_android.h" 28 #include "mojo/shell/ui_application_loader_android.h"
27 #include "mojo/spy/spy.h" 29 #include "mojo/spy/spy.h"
30 #include "ui/gl/gl_share_group.h"
28 31
29 #if defined(OS_LINUX) 32 #if defined(OS_LINUX)
30 #include "mojo/shell/dbus_application_loader_linux.h" 33 #include "mojo/shell/dbus_application_loader_linux.h"
31 #endif // defined(OS_LINUX) 34 #endif // defined(OS_LINUX)
32 35
33 #if defined(OS_ANDROID) 36 #if defined(OS_ANDROID)
34 #include "mojo/shell/network_application_loader.h" 37 #include "mojo/shell/network_application_loader.h"
35 #endif // defined(OS_ANDROID) 38 #endif // defined(OS_ANDROID)
36 39
37 #if defined(USE_AURA) 40 #if defined(USE_AURA)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 91 }
89 loader->RegisterContentHandler(parts[i], url); 92 loader->RegisterContentHandler(parts[i], url);
90 } 93 }
91 } 94 }
92 95
93 } // namespace 96 } // namespace
94 97
95 class Context::NativeViewportApplicationLoader 98 class Context::NativeViewportApplicationLoader
96 : public ApplicationLoader, 99 : public ApplicationLoader,
97 public ApplicationDelegate, 100 public ApplicationDelegate,
98 public InterfaceFactory<NativeViewport> { 101 public InterfaceFactory<NativeViewport>,
102 public InterfaceFactory<Gpu> {
99 public: 103 public:
100 NativeViewportApplicationLoader() {} 104 NativeViewportApplicationLoader()
105 : share_group_(new gfx::GLShareGroup),
106 mailbox_manager_(new gpu::gles2::MailboxManager) {}
101 virtual ~NativeViewportApplicationLoader() {} 107 virtual ~NativeViewportApplicationLoader() {}
102 108
103 private: 109 private:
104 // ApplicationLoader implementation. 110 // ApplicationLoader implementation.
105 virtual void Load(ApplicationManager* manager, 111 virtual void Load(ApplicationManager* manager,
106 const GURL& url, 112 const GURL& url,
107 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE { 113 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE {
108 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); 114 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication();
109 if (shell_handle.is_valid()) 115 if (shell_handle.is_valid())
110 app_.reset(new ApplicationImpl(this, shell_handle.Pass())); 116 app_.reset(new ApplicationImpl(this, shell_handle.Pass()));
111 } 117 }
112 118
113 virtual void OnServiceError(ApplicationManager* manager, 119 virtual void OnServiceError(ApplicationManager* manager,
114 const GURL& url) OVERRIDE {} 120 const GURL& url) OVERRIDE {}
115 121
116 // ApplicationDelegate implementation. 122 // ApplicationDelegate implementation.
117 virtual bool ConfigureIncomingConnection( 123 virtual bool ConfigureIncomingConnection(
118 mojo::ApplicationConnection* connection) OVERRIDE { 124 mojo::ApplicationConnection* connection) OVERRIDE {
119 connection->AddService(this); 125 connection->AddService<NativeViewport>(this);
126 connection->AddService<Gpu>(this);
120 return true; 127 return true;
121 } 128 }
122 129
123 // InterfaceFactory<NativeViewport> implementation. 130 // InterfaceFactory<NativeViewport> implementation.
124 virtual void Create(ApplicationConnection* connection, 131 virtual void Create(ApplicationConnection* connection,
125 InterfaceRequest<NativeViewport> request) OVERRIDE { 132 InterfaceRequest<NativeViewport> request) OVERRIDE {
126 BindToRequest(new NativeViewportImpl, &request); 133 BindToRequest(new NativeViewportImpl, &request);
127 } 134 }
128 135
136 // InterfaceFactory<Gpu> implementation.
137 virtual void Create(ApplicationConnection* connection,
138 InterfaceRequest<Gpu> request) OVERRIDE {
139 BindToRequest(new GpuImpl(share_group_.get(), mailbox_manager_.get()),
140 &request);
141 }
142
143 scoped_refptr<gfx::GLShareGroup> share_group_;
144 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
129 scoped_ptr<ApplicationImpl> app_; 145 scoped_ptr<ApplicationImpl> app_;
130 DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader); 146 DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader);
131 }; 147 };
132 148
133 Context::Context() { 149 Context::Context() {
134 DCHECK(!base::MessageLoop::current()); 150 DCHECK(!base::MessageLoop::current());
135 } 151 }
136 152
137 void Context::Init() { 153 void Context::Init() {
138 setup.Get(); 154 setup.Get();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 225 }
210 #endif 226 #endif
211 } 227 }
212 228
213 Context::~Context() { 229 Context::~Context() {
214 DCHECK(!base::MessageLoop::current()); 230 DCHECK(!base::MessageLoop::current());
215 } 231 }
216 232
217 } // namespace shell 233 } // namespace shell
218 } // namespace mojo 234 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698