Disable ContentSettingBubbleModelTest.RPHAllow which is flaky.
[chromium-blink-merge.git] / content / renderer / android / synchronous_compositor_output_surface.cc
blob87792ea0de59ec588c417e9f71563f15177dcc70
1 // Copyright (c) 2013 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 #include "content/renderer/android/synchronous_compositor_output_surface.h"
7 #include "base/logging.h"
8 #include "cc/output/output_surface_client.h"
9 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
10 #include "content/public/renderer/android/synchronous_compositor_client.h"
11 #include "content/public/renderer/content_renderer_client.h"
12 #include "skia/ext/refptr.h"
13 #include "third_party/skia/include/core/SkCanvas.h"
14 #include "third_party/skia/include/core/SkPicture.h"
16 namespace content {
18 SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface(
19 int32 routing_id,
20 WebGraphicsContext3DCommandBufferImpl* context)
21 : cc::OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context)),
22 compositor_client_(NULL),
23 routing_id_(routing_id) {
24 // WARNING: may be called on any thread.
27 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {
28 DCHECK(CalledOnValidThread());
29 if (compositor_client_)
30 compositor_client_->DidDestroyCompositor(this);
33 bool SynchronousCompositorOutputSurface::BindToClient(
34 cc::OutputSurfaceClient* surface_client) {
35 DCHECK(CalledOnValidThread());
36 if (!cc::OutputSurface::BindToClient(surface_client))
37 return false;
38 GetContentClient()->renderer()->DidCreateSynchronousCompositor(routing_id_,
39 this);
40 return true;
43 void SynchronousCompositorOutputSurface::SendFrameToParentCompositor(
44 cc::CompositorFrame* frame) {
45 // Intentional no-op: see http://crbug.com/237006
48 void SynchronousCompositorOutputSurface::SetClient(
49 SynchronousCompositorClient* compositor_client) {
50 DCHECK(CalledOnValidThread());
51 compositor_client_ = compositor_client;
54 bool SynchronousCompositorOutputSurface::DemandDrawSw(SkCanvas* canvas) {
55 DCHECK(CalledOnValidThread());
56 NOTIMPLEMENTED(); // TODO(joth): call through to OutputSurfaceClient
57 return false;
60 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
61 // requirement: SynchronousCompositorOutputSurface() must only be used by
62 // embedders that supply their own compositor loop via
63 // OverrideCompositorMessageLoop().
64 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
65 return base::MessageLoop::current() && (base::MessageLoop::current() ==
66 GetContentClient()->renderer()->OverrideCompositorMessageLoop());
69 } // namespace content