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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2967963002: gpu: Reduce of BrowserGpuChannelHostFactory. (Closed)
Patch Set: . Created 3 years, 5 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/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "cc/surfaces/display.h" 44 #include "cc/surfaces/display.h"
45 #include "cc/surfaces/display_scheduler.h" 45 #include "cc/surfaces/display_scheduler.h"
46 #include "cc/surfaces/frame_sink_id_allocator.h" 46 #include "cc/surfaces/frame_sink_id_allocator.h"
47 #include "cc/trees/layer_tree_host.h" 47 #include "cc/trees/layer_tree_host.h"
48 #include "cc/trees/layer_tree_settings.h" 48 #include "cc/trees/layer_tree_settings.h"
49 #include "components/viz/common/gl_helper.h" 49 #include "components/viz/common/gl_helper.h"
50 #include "components/viz/host/host_frame_sink_manager.h" 50 #include "components/viz/host/host_frame_sink_manager.h"
51 #include "components/viz/service/display_compositor/compositor_overlay_candidate _validator_android.h" 51 #include "components/viz/service/display_compositor/compositor_overlay_candidate _validator_android.h"
52 #include "components/viz/service/display_compositor/server_shared_bitmap_manager .h" 52 #include "components/viz/service/display_compositor/server_shared_bitmap_manager .h"
53 #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" 53 #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
54 #include "content/browser/browser_main_loop.h"
54 #include "content/browser/compositor/surface_utils.h" 55 #include "content/browser/compositor/surface_utils.h"
55 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
56 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 56 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
57 #include "content/browser/gpu/compositor_util.h" 57 #include "content/browser/gpu/compositor_util.h"
58 #include "content/browser/renderer_host/render_widget_host_impl.h" 58 #include "content/browser/renderer_host/render_widget_host_impl.h"
59 #include "content/common/gpu_stream_constants.h" 59 #include "content/common/gpu_stream_constants.h"
60 #include "content/public/browser/android/compositor.h" 60 #include "content/public/browser/android/compositor.h"
61 #include "content/public/browser/android/compositor_client.h" 61 #include "content/public/browser/android/compositor_client.h"
62 #include "content/public/common/content_switches.h" 62 #include "content/public/common/content_switches.h"
63 #include "gpu/command_buffer/client/context_support.h" 63 #include "gpu/command_buffer/client/context_support.h"
64 #include "gpu/command_buffer/client/gles2_interface.h" 64 #include "gpu/command_buffer/client/gles2_interface.h"
65 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 65 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 DCHECK(!CompositorImpl::IsInitialized()); 402 DCHECK(!CompositorImpl::IsInitialized());
403 g_initialized = true; 403 g_initialized = true;
404 } 404 }
405 405
406 // static 406 // static
407 void Compositor::CreateContextProvider( 407 void Compositor::CreateContextProvider(
408 gpu::SurfaceHandle handle, 408 gpu::SurfaceHandle handle,
409 gpu::gles2::ContextCreationAttribHelper attributes, 409 gpu::gles2::ContextCreationAttribHelper attributes,
410 gpu::SharedMemoryLimits shared_memory_limits, 410 gpu::SharedMemoryLimits shared_memory_limits,
411 ContextProviderCallback callback) { 411 ContextProviderCallback callback) {
412 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( 412 BrowserMainLoop::GetInstance()
413 base::Bind(&CreateContextProviderAfterGpuChannelEstablished, handle, 413 ->gpu_channel_establish_factory()
414 attributes, shared_memory_limits, callback)); 414 ->EstablishGpuChannel(
415 base::Bind(&CreateContextProviderAfterGpuChannelEstablished, handle,
416 attributes, shared_memory_limits, callback));
415 } 417 }
416 418
417 // static 419 // static
418 cc::SurfaceManager* CompositorImpl::GetSurfaceManager() { 420 cc::SurfaceManager* CompositorImpl::GetSurfaceManager() {
419 return g_compositor_dependencies.Get().frame_sink_manager->surface_manager(); 421 return g_compositor_dependencies.Get().frame_sink_manager->surface_manager();
420 } 422 }
421 423
422 // static 424 // static
423 viz::HostFrameSinkManager* CompositorImpl::GetHostFrameSinkManager() { 425 viz::HostFrameSinkManager* CompositorImpl::GetHostFrameSinkManager() {
424 return &g_compositor_dependencies.Get().host_frame_sink_manager; 426 return &g_compositor_dependencies.Get().host_frame_sink_manager;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 const int64_t kGpuChannelTimeoutInSeconds = 20; 680 const int64_t kGpuChannelTimeoutInSeconds = 20;
679 #endif 681 #endif
680 682
681 // Start the timer first, if the result comes synchronously, we want it to 683 // Start the timer first, if the result comes synchronously, we want it to
682 // stop in the callback. 684 // stop in the callback.
683 establish_gpu_channel_timeout_.Start( 685 establish_gpu_channel_timeout_.Start(
684 FROM_HERE, base::TimeDelta::FromSeconds(kGpuChannelTimeoutInSeconds), 686 FROM_HERE, base::TimeDelta::FromSeconds(kGpuChannelTimeoutInSeconds),
685 this, &CompositorImpl::OnGpuChannelTimeout); 687 this, &CompositorImpl::OnGpuChannelTimeout);
686 688
687 DCHECK(surface_handle_ != gpu::kNullSurfaceHandle); 689 DCHECK(surface_handle_ != gpu::kNullSurfaceHandle);
688 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel(base::Bind( 690 BrowserMainLoop::GetInstance()
689 &CompositorImpl::OnGpuChannelEstablished, weak_factory_.GetWeakPtr())); 691 ->gpu_channel_establish_factory()
692 ->EstablishGpuChannel(base::Bind(&CompositorImpl::OnGpuChannelEstablished,
693 weak_factory_.GetWeakPtr()));
690 } 694 }
691 695
692 void CompositorImpl::OnGpuChannelTimeout() { 696 void CompositorImpl::OnGpuChannelTimeout() {
693 LOG(FATAL) << "Timed out waiting for GPU channel."; 697 LOG(FATAL) << "Timed out waiting for GPU channel.";
694 } 698 }
695 699
696 #if BUILDFLAG(ENABLE_VULKAN) 700 #if BUILDFLAG(ENABLE_VULKAN)
697 void CompositorImpl::CreateVulkanOutputSurface() { 701 void CompositorImpl::CreateVulkanOutputSurface() {
698 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 702 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
699 switches::kEnableVulkan)) 703 switches::kEnableVulkan))
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 } 910 }
907 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, 911 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_,
908 frame_sink_id); 912 frame_sink_id);
909 } 913 }
910 914
911 bool CompositorImpl::HavePendingReadbacks() { 915 bool CompositorImpl::HavePendingReadbacks() {
912 return !readback_layer_tree_->children().empty(); 916 return !readback_layer_tree_->children().empty();
913 } 917 }
914 918
915 } // namespace content 919 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698