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

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

Issue 619843002: cc: Make separate interface for BeginFrame ipc from OutputSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "cc/scheduler/begin_frame_source.h"
12
13 namespace IPC {
14 class ForwardingMessageFilter;
15 class Message;
16 class SyncMessageFilter;
17 }
18
19 namespace content {
20
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.
23 class CompositorExternalBeginFrameSource : public cc::ExternalBeginFrameSource {
24 public:
25 explicit CompositorExternalBeginFrameSource(int routing_id);
26
27 // cc::ExternalBeginFrameSource implementation.
28 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) override;
29 virtual void SetClientReady() override;
30
31 private:
32 class CompositorExternalBeginFrameSourceProxy
33 : public base::RefCountedThreadSafe<
34 CompositorExternalBeginFrameSourceProxy> {
35 public:
36 explicit CompositorExternalBeginFrameSourceProxy(
37 CompositorExternalBeginFrameSource* begin_frame_source)
38 : begin_frame_source_(begin_frame_source) {}
39 void ClearBeginFrameSource() { begin_frame_source_ = NULL; }
40 void OnMessageReceived(const IPC::Message& message) {
41 if (begin_frame_source_)
42 begin_frame_source_->OnMessageReceived(message);
43 }
44
45 private:
46 friend class base::RefCountedThreadSafe<
47 CompositorExternalBeginFrameSourceProxy>;
48 virtual ~CompositorExternalBeginFrameSourceProxy() {}
49
50 CompositorExternalBeginFrameSource* begin_frame_source_;
51
52 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSourceProxy);
53 };
54
55 virtual ~CompositorExternalBeginFrameSource();
56
57 void OnMessageReceived(const IPC::Message& message);
58
59 void OnBeginFrame(const cc::BeginFrameArgs& args);
60 bool Send(IPC::Message* message);
61
62 scoped_refptr<IPC::ForwardingMessageFilter> begin_frame_source_filter_;
63 scoped_refptr<CompositorExternalBeginFrameSourceProxy>
64 begin_frame_source_proxy_;
65 scoped_refptr<IPC::SyncMessageFilter> message_sender_;
66 int routing_id_;
67
68 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSource);
69 };
70
71 } // namespace content
72
73 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698