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

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

Issue 2688193002: Mojo framework for AndroidOverlay. (Closed)
Patch Set: moved UI thread mojo init to Gpu...UIShim 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_ui_shim.h" 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "content/browser/compositor/gpu_process_transport_factory.h" 16 #include "content/browser/compositor/gpu_process_transport_factory.h"
17 #include "content/browser/gpu/compositor_util.h" 17 #include "content/browser/gpu/compositor_util.h"
18 #include "content/browser/gpu/gpu_data_manager_impl.h" 18 #include "content/browser/gpu/gpu_data_manager_impl.h"
19 #include "content/browser/gpu/gpu_process_host.h" 19 #include "content/browser/gpu/gpu_process_host.h"
20 #include "content/browser/renderer_host/render_process_host_impl.h" 20 #include "content/browser/renderer_host/render_process_host_impl.h"
21 #include "content/browser/renderer_host/render_view_host_impl.h" 21 #include "content/browser/renderer_host/render_view_host_impl.h"
22 #include "content/browser/renderer_host/render_widget_helper.h" 22 #include "content/browser/renderer_host/render_widget_helper.h"
23 #include "content/browser/renderer_host/render_widget_host_view_base.h" 23 #include "content/browser/renderer_host/render_widget_host_view_base.h"
24 #include "content/common/gpu_host_messages.h" 24 #include "content/common/gpu_host_messages.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "gpu/ipc/common/memory_stats.h" 26 #include "gpu/ipc/common/memory_stats.h"
27 #include "ui/gfx/swap_result.h" 27 #include "ui/gfx/swap_result.h"
28 28
29 #if defined(OS_ANDROID)
30 #include "content/public/browser/android/java_interfaces.h"
31 #include "media/mojo/interfaces/android_overlay.mojom.h"
32 #include "services/service_manager/public/cpp/interface_provider.h"
33 #include "services/service_manager/public/cpp/interface_registry.h"
34 #endif
35
29 #if defined(USE_OZONE) 36 #if defined(USE_OZONE)
30 #include "ui/ozone/public/gpu_platform_support_host.h" 37 #include "ui/ozone/public/gpu_platform_support_host.h"
31 #include "ui/ozone/public/ozone_platform.h" 38 #include "ui/ozone/public/ozone_platform.h"
32 #endif 39 #endif
33 40
34 namespace content { 41 namespace content {
35 42
36 namespace { 43 namespace {
37 44
38 // One of the linux specific headers defines this as a macro. 45 // One of the linux specific headers defines this as a macro.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 219
213 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); 220 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
214 } 221 }
215 222
216 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 223 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
217 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { 224 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) {
218 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 225 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
219 video_memory_usage_stats); 226 video_memory_usage_stats);
220 } 227 }
221 228
229 #if defined(OS_ANDROID)
230 template <typename Interface>
231 void BindJavaInterface(mojo::InterfaceRequest<Interface> request) {
boliu 2017/02/22 18:03:49 these two should be in an anonymous namespace
liberato (no reviews please) 2017/02/22 19:10:50 Done.
232 DCHECK_CURRENTLY_ON(BrowserThread::UI);
233 content::GetGlobalJavaInterfaces()->GetInterface(std::move(request));
234 }
235
236 // Binder which posts each request to the UI thread.
237 template <typename Interface>
238 void BindJavaInterfaceOnUIThread(mojo::InterfaceRequest<Interface> request) {
239 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)
240 ->PostTask(FROM_HERE, base::Bind(&BindJavaInterface<Interface>,
241 base::Passed(&request)));
242 }
243 #endif
244
245 // static
246 void GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces(
boliu 2017/02/22 18:03:49 This needs to be OS_ANDROID as well?
liberato (no reviews please) 2017/02/22 19:10:49 Done.
247 service_manager::InterfaceRegistry* registry) {
248 registry->AddInterface(base::Bind(
249 &BindJavaInterfaceOnUIThread<media::mojom::AndroidOverlayProvider>));
250 }
251
222 } // namespace content 252 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698