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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 2688193002: Mojo framework for AndroidOverlay. (Closed)
Patch Set: BUILD.gn fixes Created 3 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "services/service_manager/public/cpp/connection.h" 68 #include "services/service_manager/public/cpp/connection.h"
69 #include "services/service_manager/public/cpp/interface_provider.h" 69 #include "services/service_manager/public/cpp/interface_provider.h"
70 #include "services/service_manager/runner/common/client_util.h" 70 #include "services/service_manager/runner/common/client_util.h"
71 #include "ui/base/ui_base_switches.h" 71 #include "ui/base/ui_base_switches.h"
72 #include "ui/events/latency_info.h" 72 #include "ui/events/latency_info.h"
73 #include "ui/gfx/switches.h" 73 #include "ui/gfx/switches.h"
74 #include "ui/gl/gl_switches.h" 74 #include "ui/gl/gl_switches.h"
75 75
76 #if defined(OS_ANDROID) 76 #if defined(OS_ANDROID)
77 #include "base/android/build_info.h" 77 #include "base/android/build_info.h"
78 #include "content/public/browser/android/java_interfaces.h"
79 #include "media/mojo/interfaces/android_overlay.mojom.h"
80 #include "services/service_manager/public/cpp/interface_registry.h"
78 #endif 81 #endif
79 82
80 #if defined(OS_WIN) 83 #if defined(OS_WIN)
81 #include "base/win/windows_version.h" 84 #include "base/win/windows_version.h"
82 #include "content/common/sandbox_win.h" 85 #include "content/common/sandbox_win.h"
83 #include "sandbox/win/src/sandbox_policy.h" 86 #include "sandbox/win/src/sandbox_policy.h"
84 #include "ui/gfx/switches.h" 87 #include "ui/gfx/switches.h"
85 #include "ui/gfx/win/rendering_window_manager.h" 88 #include "ui/gfx/win/rendering_window_manager.h"
86 #endif 89 #endif
87 90
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 void HostLoadedShader(int host_id, 314 void HostLoadedShader(int host_id,
312 const std::string& key, 315 const std::string& key,
313 const std::string& data) { 316 const std::string& data) {
314 GpuProcessHost* host = GpuProcessHost::FromID(host_id); 317 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
315 if (host) 318 if (host)
316 host->LoadedShader(key, data); 319 host->LoadedShader(key, data);
317 } 320 }
318 321
319 } // anonymous namespace 322 } // anonymous namespace
320 323
324 #if defined(OS_ANDROID)
325 template <typename InterfaceType>
326 void AddUIInterfaceHelper(service_manager::InterfaceRegistry* registry) {
boliu 2017/02/16 22:24:19 Hmm, I don't know mojo at all.. my immediate quest
liberato (no reviews please) 2017/02/17 17:47:12 (fixed per rockot@'s suggestions.)
327 registry->AddInterface(
328 content::GetGlobalJavaInterfaces()
329 ->CreateInterfaceFactory<InterfaceType>(),
330 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI));
331 }
332
333 template <typename InterfaceType>
334 void AddUIInterface(service_manager::InterfaceRegistry* registry) {
335 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)
336 ->PostTask(FROM_HERE,
337 base::Bind(&AddUIInterfaceHelper<InterfaceType>, registry));
Ken Rockot(use gerrit already) 2017/02/17 06:29:56 This is not safe, and CreateInterfaceFactory() whi
liberato (no reviews please) 2017/02/17 17:47:12 thank you very much!
338 }
339 #endif
340
321 class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { 341 class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter {
322 public: 342 public:
323 ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {} 343 ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {}
324 344
325 private: 345 private:
326 // ConnectionFilter: 346 // ConnectionFilter:
327 bool OnConnect(const service_manager::Identity& remote_identity, 347 bool OnConnect(const service_manager::Identity& remote_identity,
328 service_manager::InterfaceRegistry* registry, 348 service_manager::InterfaceRegistry* registry,
329 service_manager::Connector* connector) override { 349 service_manager::Connector* connector) override {
330 if (remote_identity.name() != mojom::kGpuServiceName) 350 if (remote_identity.name() != mojom::kGpuServiceName)
331 return false; 351 return false;
332 352
333 GetContentClient()->browser()->ExposeInterfacesToGpuProcess(registry, 353 GetContentClient()->browser()->ExposeInterfacesToGpuProcess(registry,
334 host_); 354 host_);
355
356 #if defined(OS_ANDROID)
357 AddUIInterface<media::mojom::AndroidOverlayProvider>(registry);
358 #endif
359
335 return true; 360 return true;
336 } 361 }
337 362
338 GpuProcessHost* host_; 363 GpuProcessHost* host_;
339 364
340 DISALLOW_COPY_AND_ASSIGN(ConnectionFilterImpl); 365 DISALLOW_COPY_AND_ASSIGN(ConnectionFilterImpl);
341 }; 366 };
342 367
343 // static 368 // static
344 bool GpuProcessHost::ValidateHost(GpuProcessHost* host) { 369 bool GpuProcessHost::ValidateHost(GpuProcessHost* host) {
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 GetShaderCacheFactorySingleton()->Get(client_id); 1210 GetShaderCacheFactorySingleton()->Get(client_id);
1186 if (!cache.get()) 1211 if (!cache.get())
1187 return; 1212 return;
1188 1213
1189 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); 1214 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_));
1190 1215
1191 client_id_to_shader_cache_[client_id] = cache; 1216 client_id_to_shader_cache_[client_id] = cache;
1192 } 1217 }
1193 1218
1194 } // namespace content 1219 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/android/BUILD.gn » ('j') | media/mojo/clients/mojo_android_overlay.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698