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

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

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