0

Delete //gpu/blink/ and WebGraphicsContext3DImpl.

There is now only 1 subclass of WebGraphicsContext3DImpl (which is the
infamous WebGraphicsContext3DCommandBufferImpl), so let's delete this
in-between thing.

The use of GLES2TraceImplementation was broken, since
ContextProviderCommandBuffer was returning the underlying
GLES2Implementation directly now (woops). Fix that and move it to
the ContextProviderCommandBuffer.

Move the lost context callback to WebGraphicsContext3DCommandBufferImpl,
and remove the definition of the proxy class out of WebGraphicsContext3D
leaving the blink base class empty now.

Lots of DEPS and include removals all over the place that were already
obsolete.

R=piman, sievers
TBR=chrishtr
BUG=584497

Review URL: https://codereview.chromium.org/1907783002

Cr-Commit-Position: refs/heads/master@{#389257}
This commit is contained in:
danakj
2016-04-22 14:57:18 -07:00
committed by Commit bot
parent 6b5a32bf6c
commit 405d011dea
25 changed files with 54 additions and 286 deletions

@ -576,7 +576,6 @@ source_set("common") {
"//content/public/app:both",
"//content/public/browser",
"//gin",
"//gpu/blink",
"//gpu/command_buffer/client:gl_in_process_context",
"//gpu/command_buffer/client:gles2_c_lib",
"//gpu/command_buffer/client:gles2_implementation",

@ -246,7 +246,6 @@
'../content/content.gyp:content_app_both',
'../content/content.gyp:content_browser',
'../gin/gin.gyp:gin',
'../gpu/blink/gpu_blink.gyp:gpu_blink',
'../gpu/command_buffer/command_buffer.gyp:gles2_utils',
'../gpu/gpu.gyp:command_buffer_service',
'../gpu/gpu.gyp:gl_in_process_context',

@ -9,7 +9,6 @@
#include "base/lazy_instance.h"
#include "base/trace_event/trace_event.h"
#include "cc/output/managed_memory_policy.h"
#include "gpu/blink/webgraphicscontext3d_impl.h"
#include "gpu/command_buffer/client/gl_in_process_context.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_lib.h"

@ -160,7 +160,6 @@ source_set("common") {
"//components/tracing:startup_tracing",
"//device/bluetooth",
"//gpu",
"//gpu/blink",
"//gpu/command_buffer/client:gles2_c_lib",
"//gpu/command_buffer/client:gles2_cmd_helper",
"//gpu/command_buffer/client:gles2_implementation",

@ -12,24 +12,28 @@
#include <vector>
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "cc/output/managed_memory_policy.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_trace_implementation.h"
#include "gpu/command_buffer/client/gpu_switches.h"
#include "gpu/skia_bindings/grcontext_for_gles2_interface.h"
#include "third_party/skia/include/gpu/GrContext.h"
namespace content {
class ContextProviderCommandBuffer::LostContextCallbackProxy
: public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback {
: public WebGraphicsContext3DCommandBufferImpl::
WebGraphicsContextLostCallback {
public:
explicit LostContextCallbackProxy(ContextProviderCommandBuffer* provider)
: provider_(provider) {
provider_->context3d_->setContextLostCallback(this);
provider_->context3d_->SetContextLostCallback(this);
}
~LostContextCallbackProxy() override {
provider_->context3d_->setContextLostCallback(NULL);
provider_->context3d_->SetContextLostCallback(nullptr);
}
void onContextLost() override { provider_->OnLostContext(); }
@ -56,9 +60,14 @@ ContextProviderCommandBuffer::~ContextProviderCommandBuffer() {
context_thread_checker_.CalledOnValidThread());
// Destroy references to the context3d_ before leaking it.
// TODO(danakj): Delete this.
if (context3d_->GetCommandBufferProxy())
context3d_->GetCommandBufferProxy()->SetLock(nullptr);
lost_context_callback_proxy_.reset();
if (lost_context_callback_proxy_) {
// Disconnect lost callbacks during destruction.
lost_context_callback_proxy_.reset();
}
}
gpu::CommandBufferProxyImpl*
@ -71,7 +80,6 @@ ContextProviderCommandBuffer::WebContext3D() {
DCHECK(context3d_);
DCHECK(lost_context_callback_proxy_); // Is bound to thread.
DCHECK(context_thread_checker_.CalledOnValidThread());
return context3d_.get();
}
@ -85,13 +93,20 @@ bool ContextProviderCommandBuffer::BindToCurrentThread() {
context3d_->SetContextType(context_type_);
if (!context3d_->InitializeOnCurrentThread(memory_limits_))
return false;
lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this));
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableGpuClientTracing)) {
// This wraps the real GLES2Implementation and we should always use this
// instead when it's present.
trace_impl_.reset(new gpu::gles2::GLES2TraceImplementation(
context3d_->GetImplementation()));
}
// Do this last once the context is set up.
std::string unique_context_name =
base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get());
context3d_->GetGLInterface()->TraceBeginCHROMIUM("gpu_toplevel",
unique_context_name.c_str());
lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this));
ContextGL()->TraceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str());
return true;
}
@ -104,6 +119,8 @@ gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() {
DCHECK(lost_context_callback_proxy_); // Is bound to thread.
DCHECK(context_thread_checker_.CalledOnValidThread());
if (trace_impl_)
return trace_impl_.get();
return context3d_->GetImplementation();
}
@ -118,8 +135,7 @@ class GrContext* ContextProviderCommandBuffer::GrContext() {
if (gr_context_)
return gr_context_->get();
gr_context_.reset(new skia_bindings::GrContextForGLES2Interface(
context3d_->GetGLInterface()));
gr_context_.reset(new skia_bindings::GrContextForGLES2Interface(ContextGL()));
// If GlContext is already lost, also abandon the new GrContext.
if (gr_context_->get() &&
@ -149,6 +165,7 @@ base::Lock* ContextProviderCommandBuffer::GetLock() {
gpu::Capabilities ContextProviderCommandBuffer::ContextCapabilities() {
DCHECK(lost_context_callback_proxy_); // Is bound to thread.
DCHECK(context_thread_checker_.CalledOnValidThread());
// Skips past the trace_impl_ as it doesn't have capabilities.
return context3d_->GetImplementation()->capabilities();
}

@ -19,9 +19,16 @@
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "gpu/command_buffer/client/shared_memory_limits.h"
namespace gpu {
class CommandBufferProxyImpl;
namespace gles2 {
class GLES2TraceImplementation;
}
}
namespace skia_bindings {
class GrContextForGLES2Interface;
} // namespace skia_bindings
}
namespace content {
@ -64,6 +71,7 @@ class CONTENT_EXPORT ContextProviderCommandBuffer
base::ThreadChecker context_thread_checker_;
std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_;
std::unique_ptr<gpu::gles2::GLES2TraceImplementation> trace_impl_;
std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_;
gpu::SharedMemoryLimits memory_limits_;

@ -27,7 +27,6 @@
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_trace_implementation.h"
#include "gpu/command_buffer/client/gpu_switches.h"
#include "gpu/command_buffer/client/shared_memory_limits.h"
#include "gpu/command_buffer/client/transfer_buffer.h"
@ -241,8 +240,6 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext(
gles2_helper_.get(), gles2_share_group.get(), transfer_buffer_.get(),
bind_generates_resource, lose_context_when_out_of_memory,
support_client_side_arrays, command_buffer_.get()));
SetGLInterface(real_gl_.get());
if (!real_gl_->Initialize(memory_limits.start_transfer_buffer_size,
memory_limits.min_transfer_buffer_size,
memory_limits.max_transfer_buffer_size,
@ -254,11 +251,6 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext(
if (add_to_share_group)
share_group_->AddContextLocked(this);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableGpuClientTracing)) {
trace_gl_.reset(new gpu::gles2::GLES2TraceImplementation(GetGLInterface()));
SetGLInterface(trace_gl_.get());
}
return true;
}
@ -280,17 +272,6 @@ bool WebGraphicsContext3DCommandBufferImpl::InitializeOnCurrentThread(
void WebGraphicsContext3DCommandBufferImpl::Destroy() {
share_group_->RemoveContext(this);
gpu::gles2::GLES2Interface* gl = GetGLInterface();
if (gl) {
// First flush the context to ensure that any pending frees of resources
// are completed. Otherwise, if this context is part of a share group,
// those resources might leak. Also, any remaining side effects of commands
// issued on this context might not be visible to other contexts in the
// share group.
gl->Flush();
SetGLInterface(nullptr);
}
trace_gl_.reset();
real_gl_.reset();
transfer_buffer_.reset();

@ -18,7 +18,6 @@
#include "base/synchronization/lock.h"
#include "content/common/content_export.h"
#include "content/common/gpu/client/command_buffer_metrics.h"
#include "gpu/blink/webgraphicscontext3d_impl.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/ipc/client/command_buffer_proxy_impl.h"
#include "gpu/ipc/common/surface_handle.h"
@ -44,7 +43,7 @@ class GLES2Interface;
namespace content {
class WebGraphicsContext3DCommandBufferImpl
: public gpu_blink::WebGraphicsContext3DImpl {
: public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) {
public:
enum MappedMemoryReclaimLimit {
kNoLimit = 0,
@ -94,6 +93,14 @@ class WebGraphicsContext3DCommandBufferImpl
DISALLOW_COPY_AND_ASSIGN(ShareGroup);
};
class WebGraphicsContextLostCallback {
public:
virtual void onContextLost() = 0;
protected:
virtual ~WebGraphicsContextLostCallback() {}
};
CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl(
gpu::SurfaceHandle surface_handle,
const GURL& active_url,
@ -116,6 +123,10 @@ class WebGraphicsContext3DCommandBufferImpl
return real_gl_.get();
}
void SetContextLostCallback(WebGraphicsContextLostCallback* callback) {
context_lost_callback_ = callback;
}
CONTENT_EXPORT bool InitializeOnCurrentThread(
const gpu::SharedMemoryLimits& memory_limits);
@ -158,6 +169,10 @@ class WebGraphicsContext3DCommandBufferImpl
void OnContextLost();
bool initialized_ = false;
bool initialize_failed_ = false;
WebGraphicsContextLostCallback* context_lost_callback_ = nullptr;
bool automatic_flushes_;
gpu::gles2::ContextCreationAttribHelper attributes_;

@ -8,7 +8,6 @@
'../cc/cc.gyp:cc',
'../components/tracing.gyp:tracing',
'../device/bluetooth/bluetooth.gyp:device_bluetooth',
'../gpu/blink/gpu_blink.gyp:gpu_blink',
'../gpu/command_buffer/command_buffer.gyp:gles2_utils',
'../gpu/gpu.gyp:command_buffer_service',
'../gpu/gpu.gyp:gles2_c_lib',

@ -838,7 +838,6 @@
'../components/components.gyp:display_compositor',
'../components/scheduler/scheduler.gyp:scheduler',
'../components/scheduler/scheduler.gyp:scheduler_test_support',
'../gpu/blink/gpu_blink.gyp:gpu_blink',
'../gpu/gpu.gyp:gpu_ipc_common',
'../gpu/gpu.gyp:gpu_ipc_service_test_support',
'../ipc/mojo/ipc_mojo.gyp:*',

@ -53,7 +53,6 @@ source_set("renderer") {
"//device/vibration:mojo_bindings",
"//gin",
"//gpu",
"//gpu/blink",
"//gpu/command_buffer/client:gles2_interface",
"//ipc/mojo",
"//jingle:jingle_glue",

@ -462,7 +462,6 @@ test("content_browsertests") {
"//device/vibration:mojo_bindings",
"//gin",
"//gpu",
"//gpu/blink",
"//ipc:test_support",
"//media",
"//media:test_support",
@ -927,7 +926,6 @@ test("content_gl_tests") {
"//base/test:test_support",
"//content/browser:for_content_tests",
"//content/public/common",
"//gpu/blink",
"//gpu/command_buffer/client:gl_in_process_context",
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/common",

@ -1,38 +0,0 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# GYP version: gpu/blink/gpu_blink.gyp:gpu_blink
component("blink") {
output_name = "gpu_blink"
sources = [
"gpu_blink_export.h",
"webgraphicscontext3d_impl.cc",
"webgraphicscontext3d_impl.h",
]
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
defines = [ "GPU_BLINK_IMPLEMENTATION" ]
deps = [
"//base",
"//base/third_party/dynamic_annotations",
"//cc",
"//gpu/command_buffer/client:gl_in_process_context",
"//gpu/command_buffer/client:gles2_c_lib",
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/common",
"//gpu/command_buffer/common:gles2_utils",
"//gpu/command_buffer/service",
"//gpu/skia_bindings",
"//skia",
"//third_party/WebKit/public:blink_minimal",
"//third_party/angle:translator",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gl",
]
}

@ -1,4 +0,0 @@
include_rules = [
"+third_party/WebKit/public/platform",
"+third_party/khronos/GLES2",
]

@ -1 +0,0 @@
kbr@chromium.org

@ -1,48 +0,0 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'conditions': [
['OS != "ios"', {
'targets': [
{
# GN version: //gpu/blink
'target_name': 'gpu_blink',
'type': '<(component)',
'variables': {
'chromium_code': 1,
'enable_wexit_time_destructors': 1,
},
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/cc/cc.gyp:cc',
'<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'<(DEPTH)/gpu/command_buffer/command_buffer.gyp:gles2_utils',
'<(DEPTH)/gpu/gpu.gyp:command_buffer_service',
'<(DEPTH)/gpu/gpu.gyp:gles2_c_lib',
'<(DEPTH)/gpu/gpu.gyp:gles2_implementation',
'<(DEPTH)/gpu/gpu.gyp:gl_in_process_context',
'<(DEPTH)/gpu/skia_bindings/skia_bindings.gyp:gpu_skia_bindings',
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/third_party/WebKit/public/blink.gyp:blink_minimal',
'<(angle_path)/src/angle.gyp:translator',
'<(DEPTH)/ui/gl/gl.gyp:gl',
'<(DEPTH)/ui/gfx/gfx.gyp:gfx',
'<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry',
],
'sources': [
'gpu_blink_export.h',
'webgraphicscontext3d_impl.cc',
'webgraphicscontext3d_impl.h',
],
'defines': [
'GPU_BLINK_IMPLEMENTATION',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
],
}],
],
}

@ -1,29 +0,0 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_BLINK_GPU_BLINK_EXPORT_H_
#define GPU_BLINK_GPU_BLINK_EXPORT_H_
#if defined(COMPONENT_BUILD)
#if defined(WIN32)
#if defined(GPU_BLINK_IMPLEMENTATION)
#define GPU_BLINK_EXPORT __declspec(dllexport)
#else
#define GPU_BLINK_EXPORT __declspec(dllimport)
#endif // defined(GPU_BLINK_IMPLEMENTATION)
#else // defined(WIN32)
#if defined(GPU_BLINK_IMPLEMENTATION)
#define GPU_BLINK_EXPORT __attribute__((visibility("default")))
#else
#define GPU_BLINK_EXPORT
#endif
#endif
#else // defined(COMPONENT_BUILD)
#define GPU_BLINK_EXPORT
#endif
#endif // GPU_BLINK_GPU_BLINK_EXPORT_H_

@ -1,44 +0,0 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gpu/blink/webgraphicscontext3d_impl.h"
#include <stdint.h>
#include "base/atomicops.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/sys_info.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_lib.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
#include "third_party/khronos/GLES2/gl2.h"
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1
#endif
#include "third_party/khronos/GLES2/gl2ext.h"
namespace gpu_blink {
WebGraphicsContext3DImpl::WebGraphicsContext3DImpl()
: initialized_(false),
initialize_failed_(false),
context_lost_callback_(0),
gl_(NULL) {}
WebGraphicsContext3DImpl::~WebGraphicsContext3DImpl() {
}
void WebGraphicsContext3DImpl::setContextLostCallback(
WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) {
context_lost_callback_ = cb;
}
} // namespace gpu_blink

@ -1,60 +0,0 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_
#define GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_
#include <stdint.h>
#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "gpu/blink/gpu_blink_export.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/public/platform/WebString.h"
namespace gpu {
namespace gles2 {
class GLES2Interface;
struct ContextCreationAttribHelper;
}
}
namespace gpu_blink {
class GPU_BLINK_EXPORT WebGraphicsContext3DImpl
: public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) {
public:
~WebGraphicsContext3DImpl() override;
//----------------------------------------------------------------------
// WebGraphicsContext3D methods
void setContextLostCallback(
WebGraphicsContext3D::WebGraphicsContextLostCallback* callback);
::gpu::gles2::GLES2Interface* GetGLInterface() {
return gl_;
}
protected:
WebGraphicsContext3DImpl();
void SetGLInterface(::gpu::gles2::GLES2Interface* gl) { gl_ = gl; }
bool initialized_;
bool initialize_failed_;
WebGraphicsContextLostCallback* context_lost_callback_;
::gpu::gles2::GLES2Interface* gl_;
bool lose_context_when_out_of_memory_;
};
} // namespace gpu_blink
#endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_

@ -13,7 +13,6 @@ component("blink") {
"//cc",
"//cc/blink",
"//gpu",
"//gpu/blink",
"//media",
"//media:shared_memory_support",
"//net",

@ -4,7 +4,6 @@ include_rules = [
"+cc/layers/video_layer.h",
"+components/scheduler", # Only allowed in tests.
"+gin",
"+gpu/blink",
"+media",
"+net/base",
"+net/http",

@ -15,7 +15,6 @@
'../../base/base.gyp:base',
'../../cc/cc.gyp:cc',
'../../cc/blink/cc_blink.gyp:cc_blink',
'../../gpu/blink/gpu_blink.gyp:gpu_blink',
'../../gpu/gpu.gyp:gpu',
'../../ui/gfx/gfx.gyp:gfx_geometry',
'../../net/net.gyp:net',

@ -5,7 +5,6 @@
#include "media/blink/webmediaplayer_cast_android.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/blink/webgraphicscontext3d_impl.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "media/base/android/media_common_android.h"

@ -26,7 +26,6 @@
#include "build/build_config.h"
#include "cc/blink/web_layer_impl.h"
#include "cc/layers/video_layer.h"
#include "gpu/blink/webgraphicscontext3d_impl.h"
#include "media/audio/null_audio_sink.h"
#include "media/base/bind_to_current_loop.h"
#include "media/base/cdm_context.h"

@ -34,23 +34,8 @@
#include "WebNonCopyable.h"
namespace blink {
class WebString;
// This interface abstracts the operations performed by the
// GraphicsContext3D in order to implement WebGL. Nearly all of the
// methods exposed on this interface map directly to entry points in
// the OpenGL ES 2.0 API.
class WebGraphicsContext3D : public WebNonCopyable {
public:
class WebGraphicsContextLostCallback {
public:
virtual void onContextLost() = 0;
protected:
virtual ~WebGraphicsContextLostCallback() { }
};
// This destructor needs to be public so that using classes can destroy instances if initialization fails.
virtual ~WebGraphicsContext3D() { }
};