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

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

Issue 228083002: Make ReflectorImpl use mailboxes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 82c1f467d9f38da5a88ba04fdf7195dc6dfb26c3..474cf5111591f2658744bbd8d0f0850c9a0478ea 100644
--- a/content/browser/compositor/reflector_impl.h
+++ b/content/browser/compositor/reflector_impl.h
@@ -10,6 +10,7 @@
#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"
#include "content/browser/compositor/image_transport_factory.h"
+#include "gpu/command_buffer/common/mailbox_holder.h"
#include "ui/compositor/reflector.h"
#include "ui/gfx/size.h"
@@ -24,12 +25,12 @@ class Layer;
namespace content {
+class OwnedMailbox;
class BrowserCompositorOutputSurface;
// A reflector implementation that copies the framebuffer content
// to the texture, then draw it onto the mirroring compositor.
-class ReflectorImpl : public ImageTransportFactoryObserver,
- public base::SupportsWeakPtr<ReflectorImpl>,
+class ReflectorImpl : public base::SupportsWeakPtr<ReflectorImpl>,
public ui::Reflector {
public:
ReflectorImpl(
@@ -42,7 +43,7 @@ class ReflectorImpl : public ImageTransportFactoryObserver,
return mirrored_compositor_;
}
- void InitOnImplThread();
+ void InitOnImplThread(const gpu::MailboxHolder& mailbox_holder);
void Shutdown();
void ShutdownOnImplThread();
@@ -53,13 +54,6 @@ class ReflectorImpl : public ImageTransportFactoryObserver,
// ui::Reflector implementation.
virtual void OnMirroringCompositorResized() OVERRIDE;
- // ImageTransportFactoryObsever implementation.
- virtual void OnLostResources() OVERRIDE;
-
- // Called when the output surface's size has changed.
- // This must be called on ImplThread.
- void OnReshape(gfx::Size size);
-
// Called in |BrowserCompositorOutputSurface::SwapBuffers| to copy
// the full screen image to the |texture_id_|. This must be called
// on ImplThread.
@@ -78,12 +72,15 @@ class ReflectorImpl : public ImageTransportFactoryObserver,
// Called when the source surface is bound and available. This must
// be called on ImplThread.
- void OnSourceSurfaceReady(int surface_id);
+ void OnSourceSurfaceReady(BrowserCompositorOutputSurface* surface);
+
+ void DetachFromOutputSurface();
private:
virtual ~ReflectorImpl();
void AttachToOutputSurfaceOnImplThread(
+ const gpu::MailboxHolder& mailbox_holder,
BrowserCompositorOutputSurface* surface);
void UpdateTextureSizeOnMainThread(gfx::Size size);
@@ -101,25 +98,19 @@ class ReflectorImpl : public ImageTransportFactoryObserver,
// so the ReflectorImpl gets deleted when the function returns.
static void DeleteOnMainThread(scoped_refptr<ReflectorImpl> reflector) {}
- // These variables are initialized on MainThread before
- // the reflector is attached to the output surface. Once
- // attached, they must be accessed only on ImplThraed unless
- // the context is lost. When the context is lost, these
- // will be re-ininitiailzed when the new output-surface
- // is created on MainThread.
- int texture_id_;
- base::Lock texture_lock_;
- gfx::Size texture_size_;
-
// Must be accessed only on ImplThread.
danakj 2014/04/08 16:08:01 This starts to remind me of cc::ThreadProxy. Consi
piman 2014/04/08 23:17:46 Done.
IDMap<BrowserCompositorOutputSurface>* output_surface_map_;
+ BrowserCompositorOutputSurface* output_surface_;
scoped_ptr<GLHelper> gl_helper_;
+ unsigned impl_thread_texture_id_;
+ gpu::MailboxHolder impl_thread_mailbox_holder_;
+ gfx::Size texture_size_;
// Must be accessed only on MainThread.
+ scoped_refptr<OwnedMailbox> main_thread_mailbox_;
+ bool needs_set_mailbox_;
ui::Compositor* mirrored_compositor_;
- ui::Compositor* mirroring_compositor_;
ui::Layer* mirroring_layer_;
- scoped_refptr<ui::Texture> shared_texture_;
scoped_refptr<base::MessageLoopProxy> impl_message_loop_;
scoped_refptr<base::MessageLoopProxy> main_message_loop_;
danakj 2014/04/08 16:08:01 Can this only be accessed on MainThread also? Mayb
piman 2014/04/08 23:17:46 Done.
int surface_id_;

Powered by Google App Engine
This is Rietveld 408576698