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

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

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 #include "content/renderer/gpu/compositor_external_begin_frame_source.h"
6
7 #include "content/common/view_messages.h"
8 #include "content/renderer/render_thread_impl.h"
9 #include "ipc/ipc_forwarding_message_filter.h"
10 #include "ipc/ipc_sync_channel.h"
11 #include "ipc/ipc_sync_message_filter.h"
12
13 namespace content {
14
15 CompositorExternalBeginFrameSource::CompositorExternalBeginFrameSource(
16 int routing_id)
17 : begin_frame_source_filter_(
18 RenderThreadImpl::current()->compositor_message_filter()),
19 message_sender_(RenderThreadImpl::current()->sync_message_filter()),
20 routing_id_(routing_id) {
21 DCHECK(begin_frame_source_filter_.get());
22 DCHECK(message_sender_.get());
23 DetachFromThread();
24 }
25
26 CompositorExternalBeginFrameSource::~CompositorExternalBeginFrameSource() {
27 DCHECK(CalledOnValidThread());
28 if (begin_frame_source_proxy_.get())
29 begin_frame_source_proxy_->ClearBeginFrameSource();
30 begin_frame_source_filter_->RemoveRoute(routing_id_);
31 }
32
33 void CompositorExternalBeginFrameSource::OnNeedsBeginFramesChange(
34 bool needs_begin_frames) {
35 DCHECK(CalledOnValidThread());
36 Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, needs_begin_frames));
37 }
38
39 void CompositorExternalBeginFrameSource::SetClientReady() {
40 DCHECK(CalledOnValidThread());
41 DCHECK(!begin_frame_source_proxy_.get());
42 begin_frame_source_proxy_ =
43 new CompositorExternalBeginFrameSourceProxy(this);
44 begin_frame_source_filter_->AddRoute(
45 routing_id_,
46 base::Bind(&CompositorExternalBeginFrameSourceProxy::OnMessageReceived,
47 begin_frame_source_proxy_));
48 }
49
50 void CompositorExternalBeginFrameSource::OnMessageReceived(
51 const IPC::Message& message) {
52 DCHECK(CalledOnValidThread());
53 DCHECK(begin_frame_source_proxy_.get());
54 IPC_BEGIN_MESSAGE_MAP(CompositorExternalBeginFrameSource, message)
55 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame);
56 IPC_END_MESSAGE_MAP();
57 }
58
59 void CompositorExternalBeginFrameSource::OnBeginFrame(
60 const cc::BeginFrameArgs& args) {
61 DCHECK(CalledOnValidThread());
62 CallOnBeginFrame(args);
63 }
64
65 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) {
66 return message_sender_->Send(message);
67 }
68
69 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698