OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/android/synchronous_compositor_frame_sink.h" | 5 #include "content/renderer/android/synchronous_compositor_frame_sink.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 const int64_t kFallbackTickTimeoutInMilliseconds = 100; | 50 const int64_t kFallbackTickTimeoutInMilliseconds = 100; |
51 const cc::FrameSinkId kFrameSinkId(1, 1); | 51 const cc::FrameSinkId kFrameSinkId(1, 1); |
52 | 52 |
53 // Do not limit number of resources, so use an unrealistically high value. | 53 // Do not limit number of resources, so use an unrealistically high value. |
54 const size_t kNumResourcesLimit = 10 * 1000 * 1000; | 54 const size_t kNumResourcesLimit = 10 * 1000 * 1000; |
55 | 55 |
56 class SoftwareDevice : public cc::SoftwareOutputDevice { | 56 class SoftwareDevice : public cc::SoftwareOutputDevice { |
57 public: | 57 public: |
58 SoftwareDevice(SkCanvas** canvas) : canvas_(canvas) {} | 58 SoftwareDevice(SkCanvas** canvas) : canvas_(canvas) {} |
59 | 59 |
60 void Resize(const gfx::Size& pixel_size, float scale_factor) override { | 60 void Resize(const gfx::Size& pixel_size, float device_scale_factor) override { |
61 // Intentional no-op: canvas size is controlled by the embedder. | 61 // Intentional no-op: canvas size is controlled by the embedder. |
62 } | 62 } |
63 SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override { | 63 SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override { |
64 DCHECK(*canvas_) << "BeginPaint with no canvas set"; | 64 DCHECK(*canvas_) << "BeginPaint with no canvas set"; |
65 return *canvas_; | 65 return *canvas_; |
66 } | 66 } |
67 void EndPaint() override {} | 67 void EndPaint() override {} |
68 | 68 |
69 private: | 69 private: |
70 SkCanvas** canvas_; | 70 SkCanvas** canvas_; |
(...skipping 10 matching lines...) Expand all Loading... |
81 : cc::OutputSurface(std::move(software_device)) {} | 81 : cc::OutputSurface(std::move(software_device)) {} |
82 | 82 |
83 // cc::OutputSurface implementation. | 83 // cc::OutputSurface implementation. |
84 void EnsureBackbuffer() override {} | 84 void EnsureBackbuffer() override {} |
85 void DiscardBackbuffer() override {} | 85 void DiscardBackbuffer() override {} |
86 void BindFramebuffer() override {} | 86 void BindFramebuffer() override {} |
87 void SwapBuffers(cc::OutputSurfaceFrame frame) override {} | 87 void SwapBuffers(cc::OutputSurfaceFrame frame) override {} |
88 void Reshape(const gfx::Size& size, | 88 void Reshape(const gfx::Size& size, |
89 float scale_factor, | 89 float scale_factor, |
90 const gfx::ColorSpace& color_space, | 90 const gfx::ColorSpace& color_space, |
91 bool has_alpha) override { | 91 bool has_alpha) override {} |
92 surface_size_ = size; | |
93 } | |
94 uint32_t GetFramebufferCopyTextureFormat() override { return 0; } | 92 uint32_t GetFramebufferCopyTextureFormat() override { return 0; } |
95 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override { | 93 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override { |
96 return nullptr; | 94 return nullptr; |
97 } | 95 } |
98 bool IsDisplayedAsOverlayPlane() const override { return false; } | 96 bool IsDisplayedAsOverlayPlane() const override { return false; } |
99 unsigned GetOverlayTextureId() const override { return 0; } | 97 unsigned GetOverlayTextureId() const override { return 0; } |
100 bool SurfaceIsSuspendForRecycle() const override { return false; } | 98 bool SurfaceIsSuspendForRecycle() const override { return false; } |
101 bool HasExternalStencilTest() const override { return false; } | 99 bool HasExternalStencilTest() const override { return false; } |
102 void ApplyExternalStencil() override {} | 100 void ApplyExternalStencil() override {} |
103 }; | 101 }; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 client_->ReclaimResources(resources); | 463 client_->ReclaimResources(resources); |
466 } | 464 } |
467 | 465 |
468 void SynchronousCompositorFrameSink::SetBeginFrameSource( | 466 void SynchronousCompositorFrameSink::SetBeginFrameSource( |
469 cc::BeginFrameSource* begin_frame_source) { | 467 cc::BeginFrameSource* begin_frame_source) { |
470 // Software output is synchronous and doesn't use a BeginFrameSource. | 468 // Software output is synchronous and doesn't use a BeginFrameSource. |
471 NOTREACHED(); | 469 NOTREACHED(); |
472 } | 470 } |
473 | 471 |
474 } // namespace content | 472 } // namespace content |
OLD | NEW |