| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" |
| 10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 11 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 12 #include "content/browser/compositor/image_transport_factory.h" | 13 #include "content/browser/compositor/image_transport_factory.h" |
| 13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 14 #include "gpu/command_buffer/common/mailbox_holder.h" | 15 #include "gpu/command_buffer/common/mailbox_holder.h" |
| 15 #include "ui/compositor/reflector.h" | 16 #include "ui/compositor/reflector.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 | 18 |
| 18 namespace base { class MessageLoopProxy; } | 19 namespace base { class MessageLoopProxy; } |
| 19 | 20 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 ~ReflectorImpl() override; | 41 ~ReflectorImpl() override; |
| 41 | 42 |
| 42 ui::Compositor* mirrored_compositor() { return mirrored_compositor_; } | 43 ui::Compositor* mirrored_compositor() { return mirrored_compositor_; } |
| 43 | 44 |
| 44 void Shutdown(); | 45 void Shutdown(); |
| 45 | 46 |
| 46 void DetachFromOutputSurface(); | 47 void DetachFromOutputSurface(); |
| 47 | 48 |
| 48 // ui::Reflector implementation. | 49 // ui::Reflector implementation. |
| 49 void OnMirroringCompositorResized() override; | 50 void OnMirroringCompositorResized() override; |
| 51 void AddMirroringLayer(ui::Layer* layer) override; |
| 52 void RemoveMirroringLayer(ui::Layer* layer) override; |
| 50 | 53 |
| 51 // Called in |BrowserCompositorOutputSurface::SwapBuffers| to copy | 54 // Called in |BrowserCompositorOutputSurface::SwapBuffers| to copy |
| 52 // the full screen image to the |mailbox_| texture. | 55 // the full screen image to the |mailbox_| texture. |
| 53 void OnSourceSwapBuffers(); | 56 void OnSourceSwapBuffers(); |
| 54 | 57 |
| 55 // Called in |BrowserCompositorOutputSurface::PostSubBuffer| copy | 58 // Called in |BrowserCompositorOutputSurface::PostSubBuffer| copy |
| 56 // the sub image given by |rect| to the |mailbox_| texture. | 59 // the sub image given by |rect| to the |mailbox_| texture. |
| 57 void OnSourcePostSubBuffer(const gfx::Rect& rect); | 60 void OnSourcePostSubBuffer(const gfx::Rect& rect); |
| 58 | 61 |
| 59 // Called when the source surface is bound and available. | 62 // Called when the source surface is bound and available. |
| 60 void OnSourceSurfaceReady(BrowserCompositorOutputSurface* surface); | 63 void OnSourceSurfaceReady(BrowserCompositorOutputSurface* surface); |
| 61 | 64 |
| 62 private: | 65 private: |
| 63 void UpdateTexture(const gfx::Size& size, const gfx::Rect& redraw_rect); | 66 struct LayerData; |
| 67 |
| 68 ScopedVector<ReflectorImpl::LayerData>::iterator FindLayerData( |
| 69 ui::Layer* layer); |
| 70 void UpdateTexture(LayerData* layer_data, |
| 71 const gfx::Size& size, |
| 72 const gfx::Rect& redraw_rect); |
| 64 | 73 |
| 65 ui::Compositor* mirrored_compositor_; | 74 ui::Compositor* mirrored_compositor_; |
| 66 ui::Layer* mirroring_layer_; | 75 ScopedVector<LayerData> mirroring_layers_; |
| 67 scoped_refptr<OwnedMailbox> mailbox_; | 76 scoped_refptr<OwnedMailbox> mailbox_; |
| 68 scoped_ptr<GLHelper> mirrored_compositor_gl_helper_; | 77 scoped_ptr<GLHelper> mirrored_compositor_gl_helper_; |
| 69 int mirrored_compositor_gl_helper_texture_id_; | 78 int mirrored_compositor_gl_helper_texture_id_; |
| 70 bool needs_set_mailbox_; | |
| 71 bool flip_texture_; | 79 bool flip_texture_; |
| 72 BrowserCompositorOutputSurface* output_surface_; | 80 BrowserCompositorOutputSurface* output_surface_; |
| 73 }; | 81 }; |
| 74 | 82 |
| 75 } // namespace content | 83 } // namespace content |
| 76 | 84 |
| 77 #endif // CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_ | 85 #endif // CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_ |
| OLD | NEW |