Commit 34408450 authored by piman@chromium.org's avatar piman@chromium.org

Partial revert of 146621

The original patch introduced a crash (GetCompositor() can return NULL), but
reverting the whole thing is not possible without a lot of other reverts, and
the proper fix is fairly involve (likely not reasonable to patch to the branch).

This only reverts the problematic part, and a follow up will do a proper fix.

BUG=141756


Review URL: https://chromiumcodereview.appspot.com/10828262

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151153 0039d316-1c4b-4281-b951-d872f2087c98
parent 16c78758
...@@ -57,8 +57,7 @@ class DefaultTransportFactory ...@@ -57,8 +57,7 @@ class DefaultTransportFactory
virtual scoped_refptr<ui::Texture> CreateTransportClient( virtual scoped_refptr<ui::Texture> CreateTransportClient(
const gfx::Size& size, const gfx::Size& size,
uint64 transport_handle, uint64 transport_handle) OVERRIDE {
ui::Compositor* compositor) OVERRIDE {
return NULL; return NULL;
} }
...@@ -86,27 +85,16 @@ class DefaultTransportFactory ...@@ -86,27 +85,16 @@ class DefaultTransportFactory
class ImageTransportClientTexture : public ui::Texture { class ImageTransportClientTexture : public ui::Texture {
public: public:
ImageTransportClientTexture( ImageTransportClientTexture(
WebKit::WebGraphicsContext3D* host_context,
const gfx::Size& size, const gfx::Size& size,
uint64 surface_id) uint64 surface_id)
: ui::Texture(true, size), : ui::Texture(true, size) {
host_context_(host_context) {
set_texture_id(surface_id); set_texture_id(surface_id);
} }
virtual WebKit::WebGraphicsContext3D* HostContext3D() {
return host_context_;
}
protected: protected:
virtual ~ImageTransportClientTexture() {} virtual ~ImageTransportClientTexture() {}
private: private:
// A raw pointer. This |ImageTransportClientTexture| will be destroyed
// before the |host_context_| via
// |ImageTransportFactoryObserver::OnLostContext()| handlers.
WebKit::WebGraphicsContext3D* host_context_;
DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture); DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture);
}; };
...@@ -221,13 +209,9 @@ class GpuProcessTransportFactory : public ui::ContextFactory, ...@@ -221,13 +209,9 @@ class GpuProcessTransportFactory : public ui::ContextFactory,
virtual scoped_refptr<ui::Texture> CreateTransportClient( virtual scoped_refptr<ui::Texture> CreateTransportClient(
const gfx::Size& size, const gfx::Size& size,
uint64 transport_handle, uint64 transport_handle) {
ui::Compositor* compositor) {
PerCompositorData* data = per_compositor_data_[compositor];
DCHECK(data);
scoped_refptr<ImageTransportClientTexture> image( scoped_refptr<ImageTransportClientTexture> image(
new ImageTransportClientTexture(data->shared_context.get(), new ImageTransportClientTexture(size, transport_handle));
size, transport_handle));
return image; return image;
} }
......
...@@ -76,8 +76,7 @@ class ImageTransportFactory { ...@@ -76,8 +76,7 @@ class ImageTransportFactory {
// sent by the GPU process. // sent by the GPU process.
virtual scoped_refptr<ui::Texture> CreateTransportClient( virtual scoped_refptr<ui::Texture> CreateTransportClient(
const gfx::Size& size, const gfx::Size& size,
uint64 transport_handle, uint64 transport_handle) = 0;
ui::Compositor* compositor) = 0;
// Gets a GLHelper instance, associated with the compositor context. This // Gets a GLHelper instance, associated with the compositor context. This
// GLHelper will get destroyed whenever the context is lost ( // GLHelper will get destroyed whenever the context is lost (
......
...@@ -776,8 +776,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceNew( ...@@ -776,8 +776,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceNew(
uint64 surface_handle) { uint64 surface_handle) {
ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
scoped_refptr<ui::Texture> surface(factory->CreateTransportClient( scoped_refptr<ui::Texture> surface(factory->CreateTransportClient(
gfx::Size(width_in_pixel, height_in_pixel), surface_handle, gfx::Size(width_in_pixel, height_in_pixel), surface_handle));
GetCompositor()));
if (!surface) { if (!surface) {
LOG(ERROR) << "Failed to create ImageTransport texture"; LOG(ERROR) << "Failed to create ImageTransport texture";
return; return;
......
...@@ -101,7 +101,6 @@ class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { ...@@ -101,7 +101,6 @@ class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> {
void set_texture_id(unsigned int id) { texture_id_ = id; } void set_texture_id(unsigned int id) { texture_id_ = id; }
bool flipped() const { return flipped_; } bool flipped() const { return flipped_; }
gfx::Size size() const { return size_; } gfx::Size size() const { return size_; }
virtual WebKit::WebGraphicsContext3D* HostContext3D() = 0;
protected: protected:
virtual ~Texture(); virtual ~Texture();
......
...@@ -371,14 +371,10 @@ void Layer::SetExternalTexture(Texture* texture) { ...@@ -371,14 +371,10 @@ void Layer::SetExternalTexture(Texture* texture) {
WebKit::WebLayer new_layer; WebKit::WebLayer new_layer;
if (layer_updated_externally_) { if (layer_updated_externally_) {
WebKit::WebExternalTextureLayer texture_layer = WebKit::WebExternalTextureLayer texture_layer =
WebKit::WebExternalTextureLayer::create(this); WebKit::WebExternalTextureLayer::create();
texture_layer.setFlipped(texture_->flipped()); texture_layer.setFlipped(texture_->flipped());
new_layer = texture_layer; new_layer = texture_layer;
} else { } else {
// Tell the compositor to clear references to the old texture.
WebKit::WebExternalTextureLayer texture_layer =
web_layer_.to<WebKit::WebExternalTextureLayer>();
texture_layer.willModifyTexture();
new_layer = WebKit::WebContentLayer::create(this); new_layer = WebKit::WebContentLayer::create(this);
} }
if (parent_) { if (parent_) {
...@@ -507,16 +503,6 @@ void Layer::paintContents(WebKit::WebCanvas* web_canvas, ...@@ -507,16 +503,6 @@ void Layer::paintContents(WebKit::WebCanvas* web_canvas,
canvas->Restore(); canvas->Restore();
} }
unsigned Layer::prepareTexture(WebKit::WebTextureUpdater& /* updater */) {
DCHECK(layer_updated_externally_);
return texture_->texture_id();
}
WebKit::WebGraphicsContext3D* Layer::context() {
DCHECK(layer_updated_externally_);
return texture_->HostContext3D();
}
void Layer::SetForceRenderSurface(bool force) { void Layer::SetForceRenderSurface(bool force) {
if (force_render_surface_ == force) if (force_render_surface_ == force)
return; return;
...@@ -741,8 +727,10 @@ void Layer::RecomputeDrawsContentAndUVRect() { ...@@ -741,8 +727,10 @@ void Layer::RecomputeDrawsContentAndUVRect() {
web_layer_.setBounds(ConvertSizeToPixel(this, bounds_.size())); web_layer_.setBounds(ConvertSizeToPixel(this, bounds_.size()));
} else { } else {
DCHECK(texture_); DCHECK(texture_);
unsigned int texture_id = texture_->texture_id();
WebKit::WebExternalTextureLayer texture_layer = WebKit::WebExternalTextureLayer texture_layer =
web_layer_.to<WebKit::WebExternalTextureLayer>(); web_layer_.to<WebKit::WebExternalTextureLayer>();
texture_layer.setTextureId(should_draw ? texture_id : 0);
gfx::Size texture_size; gfx::Size texture_size;
if (scale_content_) if (scale_content_)
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClient.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClient.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureLayerClient.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkRegion.h" #include "third_party/skia/include/core/SkRegion.h"
...@@ -44,8 +43,7 @@ class Texture; ...@@ -44,8 +43,7 @@ class Texture;
// NULL, but the children are not deleted. // NULL, but the children are not deleted.
class COMPOSITOR_EXPORT Layer class COMPOSITOR_EXPORT Layer
: public LayerAnimationDelegate, : public LayerAnimationDelegate,
NON_EXPORTED_BASE(public WebKit::WebContentLayerClient), NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) {
NON_EXPORTED_BASE(public WebKit::WebExternalTextureLayerClient) {
public: public:
Layer(); Layer();
explicit Layer(LayerType type); explicit Layer(LayerType type);
...@@ -262,11 +260,6 @@ class COMPOSITOR_EXPORT Layer ...@@ -262,11 +260,6 @@ class COMPOSITOR_EXPORT Layer
WebKit::WebLayer web_layer() { return web_layer_; } WebKit::WebLayer web_layer() { return web_layer_; }
// WebExternalTextureLayerClient
virtual unsigned prepareTexture(
WebKit::WebTextureUpdater& /* updater */) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
float device_scale_factor() const { return device_scale_factor_; } float device_scale_factor() const { return device_scale_factor_; }
// Forces a render surface to be used on this layer. This has no positive // Forces a render surface to be used on this layer. This has no positive
......
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