blob: 57b344ae5ed9b2b773b5e1c6adbef1879ee3ccb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_
#define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "base/time.h"
#include "cc/output_surface.h"
#include "cc/software_output_device.h"
namespace base {
class TaskRunner;
}
namespace IPC {
class ForwardingMessageFilter;
class Message;
}
namespace content {
// This class can be created only on the main thread, but then becomes pinned
// to a fixed thread when bindToClient is called.
class CompositorOutputSurface
: NON_EXPORTED_BASE(public cc::OutputSurface),
NON_EXPORTED_BASE(public base::NonThreadSafe) {
public:
static IPC::ForwardingMessageFilter* CreateFilter(
base::TaskRunner* target_task_runner);
CompositorOutputSurface(int32 routing_id,
WebKit::WebGraphicsContext3D* context3d,
cc::SoftwareOutputDevice* software);
virtual ~CompositorOutputSurface();
// cc::OutputSurface implementation.
virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE;
virtual const struct Capabilities& Capabilities() const OVERRIDE;
virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE;
virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE;
virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE;
private:
class CompositorOutputSurfaceProxy :
public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> {
public:
explicit CompositorOutputSurfaceProxy(
CompositorOutputSurface* output_surface)
: output_surface_(output_surface) {}
void ClearOutputSurface() { output_surface_ = NULL; }
void OnMessageReceived(const IPC::Message& message) {
if (output_surface_)
output_surface_->OnMessageReceived(message);
}
private:
friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>;
~CompositorOutputSurfaceProxy() {}
CompositorOutputSurface* output_surface_;
DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy);
};
void OnMessageReceived(const IPC::Message& message);
void OnUpdateVSyncParameters(
base::TimeTicks timebase, base::TimeDelta interval);
bool Send(IPC::Message* message);
scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_;
cc::OutputSurfaceClient* client_;
scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_;
int routing_id_;
struct Capabilities capabilities_;
scoped_ptr<WebKit::WebGraphicsContext3D> context3D_;
scoped_ptr<cc::SoftwareOutputDevice> software_device_;
};
} // namespace content
#endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_
|