Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / content / renderer / gpu / compositor_external_begin_frame_source.h
blob92f9184dc5d329222c69c95bc23fa962126f5849
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.
5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
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 #include "content/renderer/gpu/compositor_forwarding_message_filter.h"
14 namespace IPC {
15 class Message;
16 class SyncMessageFilter;
19 namespace content {
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
24 : public cc::BeginFrameSourceBase,
25 public NON_EXPORTED_BASE(base::NonThreadSafe) {
26 public:
27 explicit CompositorExternalBeginFrameSource(
28 CompositorForwardingMessageFilter* filter,
29 IPC::SyncMessageFilter* sync_message_filter,
30 int routing_id);
31 ~CompositorExternalBeginFrameSource() override;
33 // cc::BeginFrameSourceBase implementation.
34 void OnNeedsBeginFramesChange(bool needs_begin_frames) override;
35 void SetClientReady() override;
37 private:
38 class CompositorExternalBeginFrameSourceProxy
39 : public base::RefCountedThreadSafe<
40 CompositorExternalBeginFrameSourceProxy> {
41 public:
42 explicit CompositorExternalBeginFrameSourceProxy(
43 CompositorExternalBeginFrameSource* begin_frame_source)
44 : begin_frame_source_(begin_frame_source) {}
45 void ClearBeginFrameSource() { begin_frame_source_ = NULL; }
46 void OnMessageReceived(const IPC::Message& message) {
47 if (begin_frame_source_)
48 begin_frame_source_->OnMessageReceived(message);
51 private:
52 friend class base::RefCountedThreadSafe<
53 CompositorExternalBeginFrameSourceProxy>;
54 virtual ~CompositorExternalBeginFrameSourceProxy() {}
56 CompositorExternalBeginFrameSource* begin_frame_source_;
58 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSourceProxy);
61 void OnMessageReceived(const IPC::Message& message);
63 void OnBeginFrame(const cc::BeginFrameArgs& args);
64 bool Send(IPC::Message* message);
66 scoped_refptr<CompositorForwardingMessageFilter> begin_frame_source_filter_;
67 scoped_refptr<CompositorExternalBeginFrameSourceProxy>
68 begin_frame_source_proxy_;
69 scoped_refptr<IPC::SyncMessageFilter> message_sender_;
70 int routing_id_;
71 CompositorForwardingMessageFilter::Handler begin_frame_source_filter_handler_;
73 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSource);
76 } // namespace content
78 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_