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

Unified Diff: content/browser/renderer_host/image_transport_factory.cc

Issue 10689108: Aura: Have ui::Layer implement WebKit::WebExternalTextureLayerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable the test compositor instead. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/image_transport_factory.cc
diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc
index d51113dda34bfd241aa30032f05fe67d747fc5ad..9da7becdee2a0f073fd26d84381854c425f1f810 100644
--- a/content/browser/renderer_host/image_transport_factory.cc
+++ b/content/browser/renderer_host/image_transport_factory.cc
@@ -13,7 +13,6 @@
#include "base/observer_list.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
#include "content/browser/gpu/gpu_surface_tracker.h"
-#include "content/browser/renderer_host/image_transport_client.h"
#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
@@ -23,6 +22,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_setup.h"
+#include "ui/compositor/test_web_graphics_context_3d.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h"
#include "ui/gl/scoped_make_current.h"
@@ -55,9 +55,10 @@ class DefaultTransportFactory
gfx::GLSurfaceHandle surface) OVERRIDE {
}
- virtual scoped_refptr<ImageTransportClient> CreateTransportClient(
+ virtual scoped_refptr<ui::Texture> CreateTransportClient(
const gfx::Size& size,
- uint64* transport_handle) OVERRIDE {
+ uint64* transport_handle,
+ ui::Compositor* compositor) OVERRIDE {
return NULL;
}
@@ -86,6 +87,29 @@ class DefaultTransportFactory
DISALLOW_COPY_AND_ASSIGN(DefaultTransportFactory);
};
+class TestTransportTexture : public ui::Texture {
+ public:
+ TestTransportTexture(
+ const gfx::Size& size,
+ uint64 surface_id)
+ : ui::Texture(true, size),
+ host_context_(new ui::TestWebGraphicsContext3D()) {
+ set_texture_id(surface_id);
+ }
+
+ virtual WebKit::WebGraphicsContext3D* HostContext3D() {
+ return host_context_.get();
+ }
+
+ protected:
+ virtual ~TestTransportTexture() {}
+
+ private:
+ scoped_ptr<WebKit::WebGraphicsContext3D> host_context_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestTransportTexture);
+};
+
class TestTransportFactory : public DefaultTransportFactory {
public:
TestTransportFactory() {}
@@ -95,46 +119,41 @@ class TestTransportFactory : public DefaultTransportFactory {
return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, true);
}
- virtual scoped_refptr<ImageTransportClient> CreateTransportClient(
+ virtual scoped_refptr<ui::Texture> CreateTransportClient(
const gfx::Size& size,
- uint64* transport_handle) OVERRIDE {
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
- scoped_refptr<ImageTransportClient> surface(
- ImageTransportClient::Create(this, size));
- if (!surface || !surface->Initialize(transport_handle)) {
- LOG(ERROR) << "Failed to create ImageTransportClient";
- return NULL;
- }
- return surface;
-#else
- return NULL;
-#endif
+ uint64* transport_handle,
+ ui::Compositor* compositor) OVERRIDE {
+ return new TestTransportTexture(size, *transport_handle);
}
private:
DISALLOW_COPY_AND_ASSIGN(TestTransportFactory);
};
-class ImageTransportClientTexture : public ImageTransportClient {
+class ImageTransportClientTexture : public ui::Texture {
public:
- explicit ImageTransportClientTexture(const gfx::Size& size)
- : ImageTransportClient(true, size) {
- }
-
- virtual bool Initialize(uint64* surface_id) OVERRIDE {
- set_texture_id(*surface_id);
- return true;
+ ImageTransportClientTexture(
+ WebKit::WebGraphicsContext3D* host_context,
+ const gfx::Size& size,
+ uint64 surface_id)
+ : ui::Texture(true, size),
+ host_context_(host_context) {
+ set_texture_id(surface_id);
}
- virtual void Update() OVERRIDE {}
- virtual TransportDIB::Handle Handle() const OVERRIDE {
- return TransportDIB::DefaultHandleValue();
+ virtual WebKit::WebGraphicsContext3D* HostContext3D() {
+ return host_context_;
}
protected:
virtual ~ImageTransportClientTexture() {}
private:
+ // A weak pointer. This |ImageTransportClientTexture| will be destroyed
piman 2012/07/12 17:42:27 Nit: s/weak/raw/ to avoid confusion with WeakPtr
jonathan.backer 2012/07/13 13:26:24 Done.
+ // before the |host_context_| via
+ // |ImageTransportFactoryObserver::OnLostContext()| handlers.
+ WebKit::WebGraphicsContext3D* host_context_;
+
DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture);
};
@@ -247,12 +266,15 @@ class GpuProcessTransportFactory : public ui::ContextFactory,
}
}
- virtual scoped_refptr<ImageTransportClient> CreateTransportClient(
+ virtual scoped_refptr<ui::Texture> CreateTransportClient(
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(
- new ImageTransportClientTexture(size));
- image->Initialize(transport_handle);
+ new ImageTransportClientTexture(data->shared_context.get(),
+ size, *transport_handle));
return image;
}

Powered by Google App Engine
This is Rietveld 408576698