1 // Copyright (c) 2012 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_OUTPUT_SURFACE_H_
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/threading/non_thread_safe.h"
13 #include "base/time.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutputSurface.h"
21 class ForwardingMessageFilter
;
26 // This class can be created only on the main thread, but then becomes pinned
27 // to a fixed thread when bindToClient is called.
28 class CompositorOutputSurface
29 : NON_EXPORTED_BASE(public WebKit::WebCompositorOutputSurface
)
30 , NON_EXPORTED_BASE(public base::NonThreadSafe
) {
32 static IPC::ForwardingMessageFilter
* CreateFilter(
33 base::TaskRunner
* target_task_runner
);
35 CompositorOutputSurface(int32 routing_id
,
36 WebKit::WebGraphicsContext3D
* context3d
);
37 virtual ~CompositorOutputSurface();
39 // WebCompositorOutputSurface implementation.
40 virtual bool bindToClient(
41 WebKit::WebCompositorOutputSurfaceClient
* client
) OVERRIDE
;
42 virtual const Capabilities
& capabilities() const OVERRIDE
;
43 virtual WebKit::WebGraphicsContext3D
* context3D() const OVERRIDE
;
44 virtual void sendFrameToParentCompositor(
45 const WebKit::WebCompositorFrame
&) OVERRIDE
;
48 void OnMessageReceived(const IPC::Message
& message
);
49 void OnUpdateVSyncParameters(
50 base::TimeTicks timebase
, base::TimeDelta interval
);
52 scoped_refptr
<IPC::ForwardingMessageFilter
> output_surface_filter_
;
53 WebKit::WebCompositorOutputSurfaceClient
* client_
;
55 Capabilities capabilities_
;
56 scoped_ptr
<WebKit::WebGraphicsContext3D
> context3D_
;
59 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_