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

Unified Diff: content/browser/compositor/reflector_impl.h

Issue 1123763003: Draw the offscreen texture to reflector's surface without extra copy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved texture code to ReflectorTexture Created 5 years, 7 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/compositor/reflector_impl.h
diff --git a/content/browser/compositor/reflector_impl.h b/content/browser/compositor/reflector_impl.h
index 7f3b9fc4fe5ef3b63593e8dc6845f3447325114e..957dfc305fae5f638789f79c5b6dece329c4d693 100644
--- a/content/browser/compositor/reflector_impl.h
+++ b/content/browser/compositor/reflector_impl.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_
#define CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_
+#include "base/callback.h"
#include "base/id_map.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
@@ -13,6 +14,7 @@
#include "content/browser/compositor/image_transport_factory.h"
#include "content/common/content_export.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
+#include "ui/compositor/compositor_observer.h"
#include "ui/compositor/reflector.h"
#include "ui/gfx/geometry/size.h"
@@ -34,7 +36,8 @@ class BrowserCompositorOutputSurface;
// to the texture, then draw it onto the mirroring compositor.
class CONTENT_EXPORT ReflectorImpl
: public base::SupportsWeakPtr<ReflectorImpl>,
- public ui::Reflector {
+ public ui::Reflector,
+ public ui::CompositorObserver {
public:
ReflectorImpl(ui::Compositor* mirrored_compositor,
ui::Layer* mirroring_layer);
@@ -46,11 +49,20 @@ class CONTENT_EXPORT ReflectorImpl
void DetachFromOutputSurface();
- // ui::Reflector implementation.
+ // ui::Reflector:
void OnMirroringCompositorResized() override;
void AddMirroringLayer(ui::Layer* layer) override;
void RemoveMirroringLayer(ui::Layer* layer) override;
+ // ui::CompositorObserver:
+ void OnCompositingDidCommit(ui::Compositor* compositor) override {}
+ void OnCompositingStarted(ui::Compositor* compositor,
+ base::TimeTicks start_time) override;
+ void OnCompositingEnded(ui::Compositor* compositor) override {}
+ void OnCompositingAborted(ui::Compositor* compositor) override {}
+ void OnCompositingLockStateChanged(ui::Compositor* compositor) override {}
+ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
+
// Called in |BrowserCompositorOutputSurface::SwapBuffers| to copy
// the full screen image to the |mailbox_| texture.
void OnSourceSwapBuffers();
@@ -62,6 +74,10 @@ class CONTENT_EXPORT ReflectorImpl
// Called when the source surface is bound and available.
void OnSourceSurfaceReady(BrowserCompositorOutputSurface* surface);
+ // Called when the mailbox which has the source surface's texture
+ // is updated.
+ void OnSourceTextureMailboxUpdated(scoped_refptr<OwnedMailbox> mailbox);
+
private:
struct LayerData;
@@ -73,11 +89,12 @@ class CONTENT_EXPORT ReflectorImpl
ui::Compositor* mirrored_compositor_;
ScopedVector<LayerData> mirroring_layers_;
+
scoped_refptr<OwnedMailbox> mailbox_;
- scoped_ptr<GLHelper> mirrored_compositor_gl_helper_;
- int mirrored_compositor_gl_helper_texture_id_;
bool flip_texture_;
+ int composition_count_;
BrowserCompositorOutputSurface* output_surface_;
+ base::Closure composition_started_callback_;
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698