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/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 const size_t kNumResourcesLimit = 10 * 1000 * 1000; | 31 const size_t kNumResourcesLimit = 10 * 1000 * 1000; |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 class SynchronousCompositorOutputSurface::SoftwareDevice | 35 class SynchronousCompositorOutputSurface::SoftwareDevice |
36 : public cc::SoftwareOutputDevice { | 36 : public cc::SoftwareOutputDevice { |
37 public: | 37 public: |
38 SoftwareDevice(SynchronousCompositorOutputSurface* surface) | 38 SoftwareDevice(SynchronousCompositorOutputSurface* surface) |
39 : surface_(surface) { | 39 : surface_(surface) { |
40 } | 40 } |
41 virtual void Resize(const gfx::Size& pixel_size, | 41 void Resize(const gfx::Size& pixel_size, float scale_factor) override { |
42 float scale_factor) override { | |
43 // Intentional no-op: canvas size is controlled by the embedder. | 42 // Intentional no-op: canvas size is controlled by the embedder. |
44 } | 43 } |
45 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override { | 44 SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override { |
46 if (!surface_->current_sw_canvas_) { | 45 if (!surface_->current_sw_canvas_) { |
47 NOTREACHED() << "BeginPaint with no canvas set"; | 46 NOTREACHED() << "BeginPaint with no canvas set"; |
48 return &null_canvas_; | 47 return &null_canvas_; |
49 } | 48 } |
50 LOG_IF(WARNING, surface_->frame_holder_.get()) | 49 LOG_IF(WARNING, surface_->frame_holder_.get()) |
51 << "Mutliple calls to BeginPaint per frame"; | 50 << "Mutliple calls to BeginPaint per frame"; |
52 return surface_->current_sw_canvas_; | 51 return surface_->current_sw_canvas_; |
53 } | 52 } |
54 virtual void EndPaint(cc::SoftwareFrameData* frame_data) override { | 53 void EndPaint(cc::SoftwareFrameData* frame_data) override {} |
55 } | 54 void CopyToPixels(const gfx::Rect& rect, void* pixels) override { |
56 virtual void CopyToPixels(const gfx::Rect& rect, void* pixels) override { | |
57 NOTIMPLEMENTED(); | 55 NOTIMPLEMENTED(); |
58 } | 56 } |
59 | 57 |
60 private: | 58 private: |
61 SynchronousCompositorOutputSurface* surface_; | 59 SynchronousCompositorOutputSurface* surface_; |
62 SkCanvas null_canvas_; | 60 SkCanvas null_canvas_; |
63 | 61 |
64 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice); | 62 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice); |
65 }; | 63 }; |
66 | 64 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } | 277 } |
280 | 278 |
281 // Not using base::NonThreadSafe as we want to enforce a more exacting threading | 279 // Not using base::NonThreadSafe as we want to enforce a more exacting threading |
282 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI | 280 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI |
283 // thread. | 281 // thread. |
284 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 282 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
285 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 283 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
286 } | 284 } |
287 | 285 |
288 } // namespace content | 286 } // namespace content |
OLD | NEW |