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

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

Issue 739493002: Introduce command buffer control thread (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Route echo better Created 6 years, 1 month 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
« no previous file with comments | « mojo/services/native_viewport/main.cc ('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/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "gpu/command_buffer/service/mailbox_manager_impl.h"
19 #include "mojo/application_manager/application_loader.h" 18 #include "mojo/application_manager/application_loader.h"
20 #include "mojo/application_manager/application_manager.h" 19 #include "mojo/application_manager/application_manager.h"
21 #include "mojo/application_manager/background_shell_application_loader.h" 20 #include "mojo/application_manager/background_shell_application_loader.h"
22 #include "mojo/edk/embedder/embedder.h" 21 #include "mojo/edk/embedder/embedder.h"
23 #include "mojo/edk/embedder/simple_platform_support.h" 22 #include "mojo/edk/embedder/simple_platform_support.h"
24 #include "mojo/public/cpp/application/application_connection.h" 23 #include "mojo/public/cpp/application/application_connection.h"
25 #include "mojo/public/cpp/application/application_delegate.h" 24 #include "mojo/public/cpp/application/application_delegate.h"
26 #include "mojo/public/cpp/application/application_impl.h" 25 #include "mojo/public/cpp/application/application_impl.h"
27 #include "mojo/shell/dynamic_application_loader.h" 26 #include "mojo/shell/dynamic_application_loader.h"
28 #include "mojo/shell/external_application_listener.h" 27 #include "mojo/shell/external_application_listener.h"
29 #include "mojo/shell/in_process_dynamic_service_runner.h" 28 #include "mojo/shell/in_process_dynamic_service_runner.h"
30 #include "mojo/shell/out_of_process_dynamic_service_runner.h" 29 #include "mojo/shell/out_of_process_dynamic_service_runner.h"
31 #include "mojo/shell/switches.h" 30 #include "mojo/shell/switches.h"
32 #include "mojo/shell/ui_application_loader_android.h" 31 #include "mojo/shell/ui_application_loader_android.h"
33 #include "mojo/spy/spy.h" 32 #include "mojo/spy/spy.h"
34 33
35 #if defined(OS_ANDROID) 34 #if defined(OS_ANDROID)
36 #include "mojo/services/gles2/gpu_impl.h" 35 #include "mojo/services/gles2/gpu_impl.h"
37 #include "mojo/services/native_viewport/native_viewport_impl.h" 36 #include "mojo/services/native_viewport/native_viewport_impl.h"
38 #include "mojo/shell/network_application_loader.h" 37 #include "mojo/shell/network_application_loader.h"
39 #include "ui/gl/gl_share_group.h"
40 #endif // defined(OS_ANDROID) 38 #endif // defined(OS_ANDROID)
41 39
42 namespace mojo { 40 namespace mojo {
43 namespace shell { 41 namespace shell {
44 namespace { 42 namespace {
45 43
46 // These mojo: URLs are loaded directly from the local filesystem. They 44 // These mojo: URLs are loaded directly from the local filesystem. They
47 // correspond to shared libraries bundled alongside the mojo_shell. 45 // correspond to shared libraries bundled alongside the mojo_shell.
48 const char* kLocalMojoURLs[] = { 46 const char* kLocalMojoURLs[] = {
49 "mojo:network_service", 47 "mojo:network_service",
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 120
123 } // namespace 121 } // namespace
124 122
125 #if defined(OS_ANDROID) 123 #if defined(OS_ANDROID)
126 class Context::NativeViewportApplicationLoader 124 class Context::NativeViewportApplicationLoader
127 : public ApplicationLoader, 125 : public ApplicationLoader,
128 public ApplicationDelegate, 126 public ApplicationDelegate,
129 public InterfaceFactory<NativeViewport>, 127 public InterfaceFactory<NativeViewport>,
130 public InterfaceFactory<Gpu> { 128 public InterfaceFactory<Gpu> {
131 public: 129 public:
132 NativeViewportApplicationLoader() 130 NativeViewportApplicationLoader() : gpu_state_(new GpuImpl::State) {}
133 : share_group_(new gfx::GLShareGroup),
134 mailbox_manager_(new gpu::gles2::MailboxManagerImpl) {}
135 virtual ~NativeViewportApplicationLoader() {} 131 virtual ~NativeViewportApplicationLoader() {}
136 132
137 private: 133 private:
138 // ApplicationLoader implementation. 134 // ApplicationLoader implementation.
139 virtual void Load(ApplicationManager* manager, 135 virtual void Load(ApplicationManager* manager,
140 const GURL& url, 136 const GURL& url,
141 scoped_refptr<LoadCallbacks> callbacks) override { 137 scoped_refptr<LoadCallbacks> callbacks) override {
142 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); 138 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication();
143 if (shell_handle.is_valid()) 139 if (shell_handle.is_valid())
144 app_.reset(new ApplicationImpl(this, shell_handle.Pass())); 140 app_.reset(new ApplicationImpl(this, shell_handle.Pass()));
(...skipping 12 matching lines...) Expand all
157 153
158 // InterfaceFactory<NativeViewport> implementation. 154 // InterfaceFactory<NativeViewport> implementation.
159 virtual void Create(ApplicationConnection* connection, 155 virtual void Create(ApplicationConnection* connection,
160 InterfaceRequest<NativeViewport> request) override { 156 InterfaceRequest<NativeViewport> request) override {
161 BindToRequest(new NativeViewportImpl(app_.get(), false), &request); 157 BindToRequest(new NativeViewportImpl(app_.get(), false), &request);
162 } 158 }
163 159
164 // InterfaceFactory<Gpu> implementation. 160 // InterfaceFactory<Gpu> implementation.
165 virtual void Create(ApplicationConnection* connection, 161 virtual void Create(ApplicationConnection* connection,
166 InterfaceRequest<Gpu> request) override { 162 InterfaceRequest<Gpu> request) override {
167 new GpuImpl(request.Pass(), share_group_.get(), mailbox_manager_.get()); 163 new GpuImpl(request.Pass(), gpu_state_);
168 } 164 }
169 165
170 scoped_refptr<gfx::GLShareGroup> share_group_; 166 scoped_refptr<GpuImpl::State> gpu_state_;
171 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
172 scoped_ptr<ApplicationImpl> app_; 167 scoped_ptr<ApplicationImpl> app_;
173 DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader); 168 DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader);
174 }; 169 };
175 #endif 170 #endif
176 171
177 Context::Context() : application_manager_(this) { 172 Context::Context() : application_manager_(this) {
178 DCHECK(!base::MessageLoop::current()); 173 DCHECK(!base::MessageLoop::current());
179 } 174 }
180 175
181 Context::~Context() { 176 Context::~Context() {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 ScopedMessagePipeHandle Context::ConnectToServiceByName( 292 ScopedMessagePipeHandle Context::ConnectToServiceByName(
298 const GURL& application_url, 293 const GURL& application_url,
299 const std::string& service_name) { 294 const std::string& service_name) {
300 app_urls_.insert(application_url); 295 app_urls_.insert(application_url);
301 return application_manager_.ConnectToServiceByName( 296 return application_manager_.ConnectToServiceByName(
302 application_url, service_name).Pass(); 297 application_url, service_name).Pass();
303 } 298 }
304 299
305 } // namespace shell 300 } // namespace shell
306 } // namespace mojo 301 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/native_viewport/main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698