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

Side by Side Diff: content/browser/compositor/reflector_impl.h

Issue 865673003: Revert "compositor: Fix texture flipping for SW mirroring with surfaceless" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
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"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "content/browser/compositor/image_transport_factory.h" 12 #include "content/browser/compositor/image_transport_factory.h"
13 #include "content/common/content_export.h"
14 #include "gpu/command_buffer/common/mailbox_holder.h" 13 #include "gpu/command_buffer/common/mailbox_holder.h"
15 #include "ui/compositor/reflector.h" 14 #include "ui/compositor/reflector.h"
16 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
17 16
18 namespace base { class MessageLoopProxy; } 17 namespace base { class MessageLoopProxy; }
19 18
20 namespace gfx { class Rect; } 19 namespace gfx { class Rect; }
21 20
22 namespace ui { 21 namespace ui {
23 class Compositor; 22 class Compositor;
24 class Layer; 23 class Layer;
25 } 24 }
26 25
27 namespace content { 26 namespace content {
28 27
29 class OwnedMailbox; 28 class OwnedMailbox;
30 class BrowserCompositorOutputSurface; 29 class BrowserCompositorOutputSurface;
31 30
32 // A reflector implementation that copies the framebuffer content 31 // A reflector implementation that copies the framebuffer content
33 // to the texture, then draw it onto the mirroring compositor. 32 // to the texture, then draw it onto the mirroring compositor.
34 class CONTENT_EXPORT ReflectorImpl 33 class ReflectorImpl : public base::SupportsWeakPtr<ReflectorImpl>,
35 : public base::SupportsWeakPtr<ReflectorImpl>, 34 public ui::Reflector {
36 public ui::Reflector {
37 public: 35 public:
38 ReflectorImpl( 36 ReflectorImpl(
39 ui::Compositor* mirrored_compositor, 37 ui::Compositor* mirrored_compositor,
40 ui::Layer* mirroring_layer, 38 ui::Layer* mirroring_layer,
41 IDMap<BrowserCompositorOutputSurface>* output_surface_map, 39 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
42 base::MessageLoopProxy* compositor_thread_loop, 40 base::MessageLoopProxy* compositor_thread_loop,
43 int surface_id); 41 int surface_id);
44 42
45 ui::Compositor* mirrored_compositor() { 43 ui::Compositor* mirrored_compositor() {
46 return GetMain().mirrored_compositor; 44 return GetMain().mirrored_compositor;
(...skipping 26 matching lines...) Expand all
73 // impl thread. 71 // impl thread.
74 void CreateSharedTextureOnMainThread(gfx::Size size); 72 void CreateSharedTextureOnMainThread(gfx::Size size);
75 73
76 // Called when the source surface is bound and available. This must 74 // Called when the source surface is bound and available. This must
77 // be called on ImplThread. 75 // be called on ImplThread.
78 void OnSourceSurfaceReady(BrowserCompositorOutputSurface* surface); 76 void OnSourceSurfaceReady(BrowserCompositorOutputSurface* surface);
79 77
80 void DetachFromOutputSurface(); 78 void DetachFromOutputSurface();
81 79
82 private: 80 private:
83 friend class ReflectorImplTest;
84
85 struct MainThreadData { 81 struct MainThreadData {
86 MainThreadData(ui::Compositor* mirrored_compositor, 82 MainThreadData(ui::Compositor* mirrored_compositor,
87 ui::Layer* mirroring_layer); 83 ui::Layer* mirroring_layer);
88 ~MainThreadData(); 84 ~MainThreadData();
89 scoped_refptr<OwnedMailbox> mailbox; 85 scoped_refptr<OwnedMailbox> mailbox;
90 bool needs_set_mailbox; 86 bool needs_set_mailbox;
91 ui::Compositor* mirrored_compositor; 87 ui::Compositor* mirrored_compositor;
92 ui::Layer* mirroring_layer; 88 ui::Layer* mirroring_layer;
93 bool flip_texture;
94 }; 89 };
95 90
96 struct ImplThreadData { 91 struct ImplThreadData {
97 explicit ImplThreadData( 92 explicit ImplThreadData(
98 IDMap<BrowserCompositorOutputSurface>* output_surface_map); 93 IDMap<BrowserCompositorOutputSurface>* output_surface_map);
99 ~ImplThreadData(); 94 ~ImplThreadData();
100 IDMap<BrowserCompositorOutputSurface>* output_surface_map; 95 IDMap<BrowserCompositorOutputSurface>* output_surface_map;
101 BrowserCompositorOutputSurface* output_surface; 96 BrowserCompositorOutputSurface* output_surface;
102 scoped_ptr<GLHelper> gl_helper; 97 scoped_ptr<GLHelper> gl_helper;
103 unsigned texture_id; 98 unsigned texture_id;
104 gpu::MailboxHolder mailbox_holder; 99 gpu::MailboxHolder mailbox_holder;
105 }; 100 };
106 101
107 ~ReflectorImpl() override; 102 ~ReflectorImpl() override;
108 103
109 void AttachToOutputSurfaceOnImplThread( 104 void AttachToOutputSurfaceOnImplThread(
110 const gpu::MailboxHolder& mailbox_holder, 105 const gpu::MailboxHolder& mailbox_holder,
111 BrowserCompositorOutputSurface* surface); 106 BrowserCompositorOutputSurface* surface);
112 107
113 void UpdateTextureSizeOnMainThread(gfx::Size size); 108 void UpdateTextureSizeOnMainThread(gfx::Size size);
114 109
115 // Request full redraw on mirroring compositor. 110 // Request full redraw on mirroring compositor.
116 void FullRedrawOnMainThread(gfx::Size size); 111 void FullRedrawOnMainThread(gfx::Size size);
117 112
118 void UpdateSubBufferOnMainThread(const gfx::Size& size, 113 void UpdateSubBufferOnMainThread(gfx::Size size, gfx::Rect rect);
119 const gfx::Rect& rect);
120 114
121 // Request full redraw on mirrored compositor so that 115 // Request full redraw on mirrored compositor so that
122 // the full content will be copied to mirroring compositor. 116 // the full content will be copied to mirroring compositor.
123 void FullRedrawContentOnMainThread(bool flip_texture); 117 void FullRedrawContentOnMainThread();
124 118
125 // This exists just to hold a reference to a ReflectorImpl in a post task, 119 // This exists just to hold a reference to a ReflectorImpl in a post task,
126 // so the ReflectorImpl gets deleted when the function returns. 120 // so the ReflectorImpl gets deleted when the function returns.
127 static void DeleteOnMainThread(scoped_refptr<ReflectorImpl> reflector) {} 121 static void DeleteOnMainThread(scoped_refptr<ReflectorImpl> reflector) {}
128 122
129 MainThreadData& GetMain(); 123 MainThreadData& GetMain();
130 ImplThreadData& GetImpl(); 124 ImplThreadData& GetImpl();
131 125
132 // Must be accessed only on ImplThread, through GetImpl(). 126 // Must be accessed only on ImplThread, through GetImpl().
133 ImplThreadData impl_unsafe_; 127 ImplThreadData impl_unsafe_;
134 128
135 // Must be accessed only on MainThread, through GetMain(). 129 // Must be accessed only on MainThread, through GetMain().
136 MainThreadData main_unsafe_; 130 MainThreadData main_unsafe_;
137 131
138 // Can be accessed on both. 132 // Can be accessed on both.
139 scoped_refptr<base::MessageLoopProxy> impl_message_loop_; 133 scoped_refptr<base::MessageLoopProxy> impl_message_loop_;
140 scoped_refptr<base::MessageLoopProxy> main_message_loop_; 134 scoped_refptr<base::MessageLoopProxy> main_message_loop_;
141 int surface_id_; 135 int surface_id_;
142 }; 136 };
143 137
144 } // namespace content 138 } // namespace content
145 139
146 #endif // CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_ 140 #endif // CONTENT_BROWSER_COMPOSITOR_REFLECTOR_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/compositor/browser_compositor_output_surface.cc ('k') | content/browser/compositor/reflector_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698