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

Side by Side Diff: content/renderer/gpu/compositor_external_begin_frame_source.h

Issue 2061273002: cc: Make BackToBackBeginFrameSource a SyntheticBeginFrameSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: syntheticbeginframesource: delete-DEBUG_FRAMES Created 4 years, 6 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_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
7 7
8 #include <unordered_set>
9
8 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
11 #include "cc/scheduler/begin_frame_source.h" 13 #include "cc/scheduler/begin_frame_source.h"
12 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" 14 #include "content/renderer/gpu/compositor_forwarding_message_filter.h"
13 15
14 namespace IPC { 16 namespace IPC {
15 class Message; 17 class Message;
16 class SyncMessageFilter; 18 class SyncMessageFilter;
17 } 19 }
18 20
19 namespace content { 21 namespace content {
20 22
21 // This class can be created only on the main thread, but then becomes pinned 23 // This class can be created only on the main thread, but then becomes pinned
22 // to a fixed thread where cc::Scheduler is running. 24 // to a fixed thread where cc::Scheduler is running.
23 class CompositorExternalBeginFrameSource 25 class CompositorExternalBeginFrameSource
24 : public cc::BeginFrameSourceBase, 26 : public cc::BeginFrameSource,
25 public NON_EXPORTED_BASE(base::NonThreadSafe) { 27 public NON_EXPORTED_BASE(base::NonThreadSafe) {
26 public: 28 public:
27 explicit CompositorExternalBeginFrameSource( 29 explicit CompositorExternalBeginFrameSource(
28 CompositorForwardingMessageFilter* filter, 30 CompositorForwardingMessageFilter* filter,
29 IPC::SyncMessageFilter* sync_message_filter, 31 IPC::SyncMessageFilter* sync_message_filter,
30 int routing_id); 32 int routing_id);
31 ~CompositorExternalBeginFrameSource() override; 33 ~CompositorExternalBeginFrameSource() override;
32 34
33 // cc::BeginFrameSourceBase implementation. 35 // cc::BeginFrameSource implementation.
34 void AddObserver(cc::BeginFrameObserver* obs) override; 36 void AddObserver(cc::BeginFrameObserver* obs) override;
35 void OnNeedsBeginFramesChanged(bool needs_begin_frames) override; 37 void RemoveObserver(cc::BeginFrameObserver* obs) override;
38 void DidFinishFrame(cc::BeginFrameObserver* obs,
39 size_t remaining_frames) override {}
36 40
37 private: 41 private:
38 class CompositorExternalBeginFrameSourceProxy 42 class CompositorExternalBeginFrameSourceProxy
39 : public base::RefCountedThreadSafe< 43 : public base::RefCountedThreadSafe<
40 CompositorExternalBeginFrameSourceProxy> { 44 CompositorExternalBeginFrameSourceProxy> {
41 public: 45 public:
42 explicit CompositorExternalBeginFrameSourceProxy( 46 explicit CompositorExternalBeginFrameSourceProxy(
43 CompositorExternalBeginFrameSource* begin_frame_source) 47 CompositorExternalBeginFrameSource* begin_frame_source)
44 : begin_frame_source_(begin_frame_source) {} 48 : begin_frame_source_(begin_frame_source) {}
45 void ClearBeginFrameSource() { begin_frame_source_ = NULL; } 49 void ClearBeginFrameSource() { begin_frame_source_ = NULL; }
46 void OnMessageReceived(const IPC::Message& message) { 50 void OnMessageReceived(const IPC::Message& message) {
47 if (begin_frame_source_) 51 if (begin_frame_source_)
48 begin_frame_source_->OnMessageReceived(message); 52 begin_frame_source_->OnMessageReceived(message);
49 } 53 }
50 54
51 private: 55 private:
52 friend class base::RefCountedThreadSafe< 56 friend class base::RefCountedThreadSafe<
53 CompositorExternalBeginFrameSourceProxy>; 57 CompositorExternalBeginFrameSourceProxy>;
54 virtual ~CompositorExternalBeginFrameSourceProxy() {} 58 virtual ~CompositorExternalBeginFrameSourceProxy() {}
55 59
56 CompositorExternalBeginFrameSource* begin_frame_source_; 60 CompositorExternalBeginFrameSource* begin_frame_source_;
57 61
58 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSourceProxy); 62 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSourceProxy);
59 }; 63 };
60 64
61 void SetClientReady(); 65 void SetClientReady();
62 void OnMessageReceived(const IPC::Message& message); 66 void OnMessageReceived(const IPC::Message& message);
63 67
68 void OnSetBeginFrameSourcePaused(bool paused);
64 void OnBeginFrame(const cc::BeginFrameArgs& args); 69 void OnBeginFrame(const cc::BeginFrameArgs& args);
65 bool Send(IPC::Message* message); 70 bool Send(IPC::Message* message);
66 71
67 scoped_refptr<CompositorForwardingMessageFilter> begin_frame_source_filter_; 72 scoped_refptr<CompositorForwardingMessageFilter> begin_frame_source_filter_;
68 scoped_refptr<CompositorExternalBeginFrameSourceProxy> 73 scoped_refptr<CompositorExternalBeginFrameSourceProxy>
69 begin_frame_source_proxy_; 74 begin_frame_source_proxy_;
70 scoped_refptr<IPC::SyncMessageFilter> message_sender_; 75 scoped_refptr<IPC::SyncMessageFilter> message_sender_;
71 int routing_id_; 76 int routing_id_;
72 CompositorForwardingMessageFilter::Handler begin_frame_source_filter_handler_; 77 CompositorForwardingMessageFilter::Handler begin_frame_source_filter_handler_;
73 cc::BeginFrameArgs missed_begin_frame_args_; 78 cc::BeginFrameArgs missed_begin_frame_args_;
79 std::unordered_set<cc::BeginFrameObserver*> observers_;
80 bool paused_ = false;
74 81
75 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSource); 82 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSource);
76 }; 83 };
77 84
78 } // namespace content 85 } // namespace content
79 86
80 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ 87 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698