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

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

Powered by Google App Engine
This is Rietveld 408576698