Chromium Code Reviews| 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/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 // impl thread. | 71 // impl thread. |
| 72 void CreateSharedTextureOnMainThread(gfx::Size size); | 72 void CreateSharedTextureOnMainThread(gfx::Size size); |
| 73 | 73 |
| 74 // Called when the source surface is bound and available. This must | 74 // Called when the source surface is bound and available. This must |
| 75 // be called on ImplThread. | 75 // be called on ImplThread. |
| 76 void OnSourceSurfaceReady(BrowserCompositorOutputSurface* surface); | 76 void OnSourceSurfaceReady(BrowserCompositorOutputSurface* surface); |
| 77 | 77 |
| 78 void DetachFromOutputSurface(); | 78 void DetachFromOutputSurface(); |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 friend class ReflectorImplTest; | |
| 82 | |
| 81 struct MainThreadData { | 83 struct MainThreadData { |
| 82 MainThreadData(ui::Compositor* mirrored_compositor, | 84 MainThreadData(ui::Compositor* mirrored_compositor, |
| 83 ui::Layer* mirroring_layer); | 85 ui::Layer* mirroring_layer); |
| 84 ~MainThreadData(); | 86 ~MainThreadData(); |
| 85 scoped_refptr<OwnedMailbox> mailbox; | 87 scoped_refptr<OwnedMailbox> mailbox; |
| 86 bool needs_set_mailbox; | 88 bool needs_set_mailbox; |
| 87 ui::Compositor* mirrored_compositor; | 89 ui::Compositor* mirrored_compositor; |
| 88 ui::Layer* mirroring_layer; | 90 ui::Layer* mirroring_layer; |
| 89 }; | 91 }; |
| 90 | 92 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 103 | 105 |
| 104 void AttachToOutputSurfaceOnImplThread( | 106 void AttachToOutputSurfaceOnImplThread( |
| 105 const gpu::MailboxHolder& mailbox_holder, | 107 const gpu::MailboxHolder& mailbox_holder, |
| 106 BrowserCompositorOutputSurface* surface); | 108 BrowserCompositorOutputSurface* surface); |
| 107 | 109 |
| 108 void UpdateTextureSizeOnMainThread(gfx::Size size); | 110 void UpdateTextureSizeOnMainThread(gfx::Size size); |
| 109 | 111 |
| 110 // Request full redraw on mirroring compositor. | 112 // Request full redraw on mirroring compositor. |
| 111 void FullRedrawOnMainThread(gfx::Size size); | 113 void FullRedrawOnMainThread(gfx::Size size); |
| 112 | 114 |
| 113 void UpdateSubBufferOnMainThread(gfx::Size size, gfx::Rect rect); | 115 void UpdateSubBufferOnMainThread(const gfx::Size& size, |
| 116 const gfx::Rect& rect); | |
| 114 | 117 |
| 115 // Request full redraw on mirrored compositor so that | 118 // Request full redraw on mirrored compositor so that |
| 116 // the full content will be copied to mirroring compositor. | 119 // the full content will be copied to mirroring compositor. |
| 117 void FullRedrawContentOnMainThread(); | 120 void FullRedrawContentOnMainThread(); |
| 118 | 121 |
| 119 // This exists just to hold a reference to a ReflectorImpl in a post task, | 122 // This exists just to hold a reference to a ReflectorImpl in a post task, |
| 120 // so the ReflectorImpl gets deleted when the function returns. | 123 // so the ReflectorImpl gets deleted when the function returns. |
| 121 static void DeleteOnMainThread(scoped_refptr<ReflectorImpl> reflector) {} | 124 static void DeleteOnMainThread(scoped_refptr<ReflectorImpl> reflector) {} |
| 122 | 125 |
| 123 MainThreadData& GetMain(); | 126 MainThreadData& GetMain(); |
| 124 ImplThreadData& GetImpl(); | 127 ImplThreadData& GetImpl(); |
| 125 | 128 |
| 126 // Must be accessed only on ImplThread, through GetImpl(). | 129 // Must be accessed only on ImplThread, through GetImpl(). |
| 127 ImplThreadData impl_unsafe_; | 130 ImplThreadData impl_unsafe_; |
| 128 | 131 |
| 129 // Must be accessed only on MainThread, through GetMain(). | 132 // Must be accessed only on MainThread, through GetMain(). |
| 130 MainThreadData main_unsafe_; | 133 MainThreadData main_unsafe_; |
| 131 | 134 |
| 132 // Can be accessed on both. | 135 // Can be accessed on both. |
| 133 scoped_refptr<base::MessageLoopProxy> impl_message_loop_; | 136 scoped_refptr<base::MessageLoopProxy> impl_message_loop_; |
| 134 scoped_refptr<base::MessageLoopProxy> main_message_loop_; | 137 scoped_refptr<base::MessageLoopProxy> main_message_loop_; |
| 135 int surface_id_; | 138 int surface_id_; |
| 139 bool flip_texture_; | |
|
danakj
2015/01/22 01:04:20
Thanks for the test this looks nice except I think
achaulk
2015/01/23 16:45:52
Done.
| |
| 136 }; | 140 }; |
| 137 | 141 |
| 138 } // namespace content | 142 } // namespace content |
| 139 | 143 |
| 140 #endif // CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_ | 144 #endif // CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_ |
| OLD | NEW |