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

Side by Side Diff: content/browser/aura/browser_compositor_output_surface.h

Issue 23726015: All together now (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_cap
Patch Set: Created 7 years, 3 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
« no previous file with comments | « ash/shell.cc ('k') | content/browser/aura/browser_compositor_output_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ 5 #ifndef CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ 6 #define CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
7 7
8 #include "base/id_map.h" 8 #include "base/id_map.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/observer_list.h"
10 #include "base/threading/non_thread_safe.h" 11 #include "base/threading/non_thread_safe.h"
11 #include "cc/output/output_surface.h" 12 #include "cc/output/output_surface.h"
12 13
13 namespace base { class MessageLoopProxy; } 14 namespace base { class MessageLoopProxy; }
14 15
15 namespace ui { class Compositor; } 16 namespace ui { class Compositor; }
16 17
17 namespace content { 18 namespace content {
18 class ContextProviderCommandBuffer; 19 class ContextProviderCommandBuffer;
19 class ReflectorImpl;
20 class WebGraphicsContext3DCommandBufferImpl; 20 class WebGraphicsContext3DCommandBufferImpl;
21 21
22 // Adapts a WebGraphicsContext3DCommandBufferImpl into a 22 // Adapts a WebGraphicsContext3DCommandBufferImpl into a
23 // cc::OutputSurface that also handles vsync parameter updates 23 // cc::OutputSurface that also handles vsync parameter updates
24 // arriving from the GPU process. 24 // arriving from the GPU process.
25 class BrowserCompositorOutputSurface 25 class BrowserCompositorOutputSurface
26 : public cc::OutputSurface, 26 : public cc::OutputSurface,
27 public base::NonThreadSafe { 27 public base::NonThreadSafe {
28 public: 28 public:
29 // Observer class for objects to be notified of events on the output surface.
30 // These will be called on the the thread the BrowserCompositorOutputSurface
31 // binds to in BindToClient().
32 class Observer {
33 public:
34 // Called when the output surface's size has changed.
35 virtual void OnReshape(const gfx::Size& size) = 0;
36
37 // Called when the output surface swaps to the frontbuffer.
38 virtual void OnSwapBuffers() = 0;
39
40 // Called when the output surface posts a subbuffer to the frontbuffer.
41 virtual void OnPostSubBuffer(const gfx::Rect& rect) = 0;
42
43 // Called when the output surface is about to be deleted.
44 virtual void OnDelete() = 0;
45 };
46
29 BrowserCompositorOutputSurface( 47 BrowserCompositorOutputSurface(
30 const scoped_refptr<ContextProviderCommandBuffer>& context, 48 const scoped_refptr<ContextProviderCommandBuffer>& context,
31 int surface_id, 49 int surface_id,
32 IDMap<BrowserCompositorOutputSurface>* output_surface_map, 50 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
33 base::MessageLoopProxy* compositor_message_loop, 51 const scoped_refptr<base::MessageLoopProxy>& compositor_message_loop,
34 base::WeakPtr<ui::Compositor> compositor); 52 base::WeakPtr<ui::Compositor> compositor);
35 53
36 virtual ~BrowserCompositorOutputSurface(); 54 virtual ~BrowserCompositorOutputSurface();
37 55
38 // cc::OutputSurface implementation. 56 // cc::OutputSurface implementation.
39 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; 57 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE;
40 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE; 58 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE;
41 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; 59 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
42 60
43 void OnUpdateVSyncParameters(base::TimeTicks timebase, 61 void OnUpdateVSyncParameters(base::TimeTicks timebase,
44 base::TimeDelta interval); 62 base::TimeDelta interval);
45 63
46 void SetReflector(ReflectorImpl* reflector); 64 void AddObserver(Observer* observer);
65 void RemoveObserver(Observer* observer);
47 66
48 private: 67 private:
49 int surface_id_; 68 int surface_id_;
50 IDMap<BrowserCompositorOutputSurface>* output_surface_map_; 69 IDMap<BrowserCompositorOutputSurface>* output_surface_map_;
51 70
52 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_; 71 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_;
53 base::WeakPtr<ui::Compositor> compositor_; 72 base::WeakPtr<ui::Compositor> compositor_;
54 scoped_refptr<ReflectorImpl> reflector_; 73 ObserverList<Observer> observer_list_;
55 }; 74 };
56 75
57 } // namespace content 76 } // namespace content
58 77
59 #endif // CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ 78 #endif // CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | content/browser/aura/browser_compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698