Commit 131d64c7 authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

aw: s/DeferredGpuCommandService/GpuServiceWebView/

where appropriate. GpuServiceWebView is split out of
DeferredGpuCommandService to handle binding initialization and holding
global GPU objects. Most call sites should now be using
GpuServiceWebView directly instead of going through
DeferredGpuCommandService.

Bug: 987265
Change-Id: I1eb31a9f142d32bc2a4596a077c2bb2832d87891
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724500Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682464}
parent 49d0c5d9
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "android_webview/browser/gfx/aw_picture.h" #include "android_webview/browser/gfx/aw_picture.h"
#include "android_webview/browser/gfx/browser_view_renderer.h" #include "android_webview/browser/gfx/browser_view_renderer.h"
#include "android_webview/browser/gfx/child_frame.h" #include "android_webview/browser/gfx/child_frame.h"
#include "android_webview/browser/gfx/deferred_gpu_command_service.h" #include "android_webview/browser/gfx/gpu_service_web_view.h"
#include "android_webview/browser/gfx/java_browser_view_renderer_helper.h" #include "android_webview/browser/gfx/java_browser_view_renderer_helper.h"
#include "android_webview/browser/gfx/render_thread_manager.h" #include "android_webview/browser/gfx/render_thread_manager.h"
#include "android_webview/browser/gfx/scoped_app_gl_state_restore.h" #include "android_webview/browser/gfx/scoped_app_gl_state_restore.h"
...@@ -415,8 +415,9 @@ static jboolean JNI_AwContents_HasRequiredHardwareExtensions(JNIEnv* env) { ...@@ -415,8 +415,9 @@ static jboolean JNI_AwContents_HasRequiredHardwareExtensions(JNIEnv* env) {
// Make sure GPUInfo is collected. This will initialize GL bindings, // Make sure GPUInfo is collected. This will initialize GL bindings,
// collect GPUInfo, and compute GpuFeatureInfo if they have not been // collect GPUInfo, and compute GpuFeatureInfo if they have not been
// already done. // already done.
return DeferredGpuCommandService::GetInstance() return GpuServiceWebView::GetInstance()
->CanSupportThreadedTextureMailbox(); ->gpu_info()
.can_support_threaded_texture_mailbox;
} }
static void JNI_AwContents_SetAwDrawSWFunctionTable(JNIEnv* env, static void JNI_AwContents_SetAwDrawSWFunctionTable(JNIEnv* env,
......
...@@ -4,19 +4,9 @@ ...@@ -4,19 +4,9 @@
#include "android_webview/browser/gfx/deferred_gpu_command_service.h" #include "android_webview/browser/gfx/deferred_gpu_command_service.h"
#include "android_webview/browser/gfx/render_thread_manager.h" #include "android_webview/browser/gfx/gpu_service_web_view.h"
#include "android_webview/browser/gfx/task_forwarding_sequence.h" #include "android_webview/browser/gfx/task_forwarding_sequence.h"
#include "android_webview/browser/gfx/task_queue_web_view.h" #include "android_webview/browser/gfx/task_queue_web_view.h"
#include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/gpu_utils.h"
#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/mailbox_manager_factory.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "gpu/config/gpu_info.h"
#include "gpu/config/gpu_util.h"
#include "ui/gl/gl_share_group.h" #include "ui/gl/gl_share_group.h"
namespace android_webview { namespace android_webview {
...@@ -80,8 +70,4 @@ bool DeferredGpuCommandService::ShouldCreateMemoryTracker() const { ...@@ -80,8 +70,4 @@ bool DeferredGpuCommandService::ShouldCreateMemoryTracker() const {
return false; return false;
} }
bool DeferredGpuCommandService::CanSupportThreadedTextureMailbox() const {
return gpu_info().can_support_threaded_texture_mailbox;
}
} // namespace android_webview } // namespace android_webview
...@@ -5,23 +5,13 @@ ...@@ -5,23 +5,13 @@
#ifndef ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_ #ifndef ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_
#define ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_ #define ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_
#include <stddef.h>
#include <memory>
#include <utility>
#include "android_webview/browser/gfx/gpu_service_web_view.h"
#include "base/lazy_instance.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/threading/thread_checker.h"
#include "base/threading/thread_local.h"
#include "base/time/time.h"
#include "gpu/config/gpu_info.h"
#include "gpu/ipc/command_buffer_task_executor.h" #include "gpu/ipc/command_buffer_task_executor.h"
namespace android_webview { namespace android_webview {
class GpuServiceWebView;
class TaskQueueWebView; class TaskQueueWebView;
class ScopedAllowGL;
// Implementation for gpu service objects accessor for command buffer WebView. // Implementation for gpu service objects accessor for command buffer WebView.
class DeferredGpuCommandService : public gpu::CommandBufferTaskExecutor { class DeferredGpuCommandService : public gpu::CommandBufferTaskExecutor {
...@@ -36,15 +26,10 @@ class DeferredGpuCommandService : public gpu::CommandBufferTaskExecutor { ...@@ -36,15 +26,10 @@ class DeferredGpuCommandService : public gpu::CommandBufferTaskExecutor {
void ScheduleDelayedWork(base::OnceClosure task) override; void ScheduleDelayedWork(base::OnceClosure task) override;
void PostNonNestableToClient(base::OnceClosure callback) override; void PostNonNestableToClient(base::OnceClosure callback) override;
const gpu::GPUInfo& gpu_info() const { return gpu_service_->gpu_info(); }
bool CanSupportThreadedTextureMailbox() const;
protected: protected:
~DeferredGpuCommandService() override; ~DeferredGpuCommandService() override;
private: private:
friend class ScopedAllowGL;
friend class TaskForwardingSequence; friend class TaskForwardingSequence;
DeferredGpuCommandService(TaskQueueWebView* task_queue, DeferredGpuCommandService(TaskQueueWebView* task_queue,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "android_webview/browser/gfx/compositor_frame_producer.h" #include "android_webview/browser/gfx/compositor_frame_producer.h"
#include "android_webview/browser/gfx/compositor_id.h" #include "android_webview/browser/gfx/compositor_id.h"
#include "android_webview/browser/gfx/deferred_gpu_command_service.h" #include "android_webview/browser/gfx/gpu_service_web_view.h"
#include "android_webview/browser/gfx/scoped_app_gl_state_restore.h" #include "android_webview/browser/gfx/scoped_app_gl_state_restore.h"
#include "android_webview/browser/gfx/task_queue_web_view.h" #include "android_webview/browser/gfx/task_queue_web_view.h"
#include "android_webview/public/browser/draw_gl.h" #include "android_webview/public/browser/draw_gl.h"
...@@ -186,8 +186,7 @@ void RenderThreadManager::UpdateViewTreeForceDarkStateOnRT( ...@@ -186,8 +186,7 @@ void RenderThreadManager::UpdateViewTreeForceDarkStateOnRT(
void RenderThreadManager::DrawOnRT(bool save_restore, void RenderThreadManager::DrawOnRT(bool save_restore,
HardwareRendererDrawParams* params) { HardwareRendererDrawParams* params) {
// Force GL binding init if it's not yet initialized. // Force GL binding init if it's not yet initialized.
// TODO(crbug.com/987265): Clean up usage of DeferredGpuCommandService. GpuServiceWebView::GetInstance();
DeferredGpuCommandService::GetInstance();
ScopedAppGLStateRestore state_restore(ScopedAppGLStateRestore::MODE_DRAW, ScopedAppGLStateRestore state_restore(ScopedAppGLStateRestore::MODE_DRAW,
save_restore); save_restore);
ScopedAllowGL allow_gl; ScopedAllowGL allow_gl;
...@@ -202,7 +201,7 @@ void RenderThreadManager::DrawOnRT(bool save_restore, ...@@ -202,7 +201,7 @@ void RenderThreadManager::DrawOnRT(bool save_restore,
} }
void RenderThreadManager::DestroyHardwareRendererOnRT(bool save_restore) { void RenderThreadManager::DestroyHardwareRendererOnRT(bool save_restore) {
DeferredGpuCommandService::GetInstance(); GpuServiceWebView::GetInstance();
ScopedAppGLStateRestore state_restore( ScopedAppGLStateRestore state_restore(
ScopedAppGLStateRestore::MODE_RESOURCE_MANAGEMENT, save_restore); ScopedAppGLStateRestore::MODE_RESOURCE_MANAGEMENT, save_restore);
ScopedAllowGL allow_gl; ScopedAllowGL allow_gl;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "android_webview/browser/aw_content_browser_client.h" #include "android_webview/browser/aw_content_browser_client.h"
#include "android_webview/browser/aw_media_url_interceptor.h" #include "android_webview/browser/aw_media_url_interceptor.h"
#include "android_webview/browser/gfx/browser_view_renderer.h" #include "android_webview/browser/gfx/browser_view_renderer.h"
#include "android_webview/browser/gfx/deferred_gpu_command_service.h" #include "android_webview/browser/gfx/gpu_service_web_view.h"
#include "android_webview/browser/scoped_add_feature_flags.h" #include "android_webview/browser/scoped_add_feature_flags.h"
#include "android_webview/browser/tracing/aw_trace_event_args_whitelist.h" #include "android_webview/browser/tracing/aw_trace_event_args_whitelist.h"
#include "android_webview/common/aw_descriptors.h" #include "android_webview/common/aw_descriptors.h"
...@@ -316,16 +316,16 @@ content::ContentBrowserClient* AwMainDelegate::CreateContentBrowserClient() { ...@@ -316,16 +316,16 @@ content::ContentBrowserClient* AwMainDelegate::CreateContentBrowserClient() {
namespace { namespace {
gpu::SyncPointManager* GetSyncPointManager() { gpu::SyncPointManager* GetSyncPointManager() {
DCHECK(DeferredGpuCommandService::GetInstance()); DCHECK(GpuServiceWebView::GetInstance());
return DeferredGpuCommandService::GetInstance()->sync_point_manager(); return GpuServiceWebView::GetInstance()->sync_point_manager();
} }
gpu::SharedImageManager* GetSharedImageManager() { gpu::SharedImageManager* GetSharedImageManager() {
DCHECK(DeferredGpuCommandService::GetInstance()); DCHECK(GpuServiceWebView::GetInstance());
const bool enable_shared_image = const bool enable_shared_image =
base::CommandLine::ForCurrentProcess()->HasSwitch( base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kWebViewEnableSharedImage); switches::kWebViewEnableSharedImage);
return enable_shared_image return enable_shared_image
? DeferredGpuCommandService::GetInstance()->shared_image_manager() ? GpuServiceWebView::GetInstance()->shared_image_manager()
: nullptr; : nullptr;
} }
} // namespace } // namespace
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "android_webview/browser/gfx/deferred_gpu_command_service.h" #include "android_webview/browser/gfx/gpu_service_web_view.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/test/test_suite.h" #include "base/test/test_suite.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
...@@ -13,6 +13,6 @@ int main(int argc, char** argv) { ...@@ -13,6 +13,6 @@ int main(int argc, char** argv) {
base::CommandLine::ForCurrentProcess()->AppendSwitch( base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kSingleProcess); switches::kSingleProcess);
gl::GLSurfaceTestSupport::InitializeNoExtensionsOneOff(); gl::GLSurfaceTestSupport::InitializeNoExtensionsOneOff();
android_webview::DeferredGpuCommandService::GetInstance(); android_webview::GpuServiceWebView::GetInstance();
return base::TestSuite(argc, argv).Run(); return base::TestSuite(argc, argv).Run();
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment