| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 15 #include "ui/gfx/surface/transport_dib.h" | 15 #include "ui/gfx/surface/transport_dib.h" |
| 16 | 16 |
| 17 class RenderProcessHost; | 17 class RenderProcessHost; |
| 18 class RenderWidgetHost; | 18 class RenderWidgetHost; |
| 19 | 19 |
| 20 namespace gfx { | 20 namespace gfx { |
| 21 class Rect; | 21 class Rect; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace content { |
| 25 class RenderProcessHost; |
| 26 } |
| 27 |
| 24 namespace skia { | 28 namespace skia { |
| 25 class PlatformCanvas; | 29 class PlatformCanvas; |
| 26 } | 30 } |
| 27 | 31 |
| 28 // Represents a backing store for the pixels in a RenderWidgetHost. | 32 // Represents a backing store for the pixels in a RenderWidgetHost. |
| 29 class CONTENT_EXPORT BackingStore { | 33 class CONTENT_EXPORT BackingStore { |
| 30 public: | 34 public: |
| 31 virtual ~BackingStore(); | 35 virtual ~BackingStore(); |
| 32 | 36 |
| 33 RenderWidgetHost* render_widget_host() const { return render_widget_host_; } | 37 RenderWidgetHost* render_widget_host() const { return render_widget_host_; } |
| 34 const gfx::Size& size() { return size_; } | 38 const gfx::Size& size() { return size_; } |
| 35 | 39 |
| 36 // The number of bytes that this backing store consumes. The default | 40 // The number of bytes that this backing store consumes. The default |
| 37 // implementation just assumes there's 32 bits per pixel over the current | 41 // implementation just assumes there's 32 bits per pixel over the current |
| 38 // size of the screen. Implementations may override this if they have more | 42 // size of the screen. Implementations may override this if they have more |
| 39 // information about the color depth. | 43 // information about the color depth. |
| 40 virtual size_t MemorySize(); | 44 virtual size_t MemorySize(); |
| 41 | 45 |
| 42 // Paints the bitmap from the renderer onto the backing store. bitmap_rect | 46 // Paints the bitmap from the renderer onto the backing store. bitmap_rect |
| 43 // gives the location of bitmap, and copy_rects specifies the subregion(s) of | 47 // gives the location of bitmap, and copy_rects specifies the subregion(s) of |
| 44 // the backingstore to be painted from the bitmap. | 48 // the backingstore to be painted from the bitmap. |
| 45 // | 49 // |
| 46 // PaintToBackingStore does not need to guarantee that this has happened by | 50 // PaintToBackingStore does not need to guarantee that this has happened by |
| 47 // the time it returns, in which case it will set |scheduled_callback| to | 51 // the time it returns, in which case it will set |scheduled_callback| to |
| 48 // true and will call |callback| when completed. | 52 // true and will call |callback| when completed. |
| 49 virtual void PaintToBackingStore( | 53 virtual void PaintToBackingStore( |
| 50 RenderProcessHost* process, | 54 content::RenderProcessHost* process, |
| 51 TransportDIB::Id bitmap, | 55 TransportDIB::Id bitmap, |
| 52 const gfx::Rect& bitmap_rect, | 56 const gfx::Rect& bitmap_rect, |
| 53 const std::vector<gfx::Rect>& copy_rects, | 57 const std::vector<gfx::Rect>& copy_rects, |
| 54 const base::Closure& completion_callback, | 58 const base::Closure& completion_callback, |
| 55 bool* scheduled_completion_callback) = 0; | 59 bool* scheduled_completion_callback) = 0; |
| 56 | 60 |
| 57 // Extracts the gives subset of the backing store and copies it to the given | 61 // Extracts the gives subset of the backing store and copies it to the given |
| 58 // PlatformCanvas. The PlatformCanvas should not be initialized. This function | 62 // PlatformCanvas. The PlatformCanvas should not be initialized. This function |
| 59 // will call initialize() with the correct size. The return value indicates | 63 // will call initialize() with the correct size. The return value indicates |
| 60 // success. | 64 // success. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 74 // The owner of this backing store. | 78 // The owner of this backing store. |
| 75 RenderWidgetHost* render_widget_host_; | 79 RenderWidgetHost* render_widget_host_; |
| 76 | 80 |
| 77 // The size of the backing store. | 81 // The size of the backing store. |
| 78 gfx::Size size_; | 82 gfx::Size size_; |
| 79 | 83 |
| 80 DISALLOW_COPY_AND_ASSIGN(BackingStore); | 84 DISALLOW_COPY_AND_ASSIGN(BackingStore); |
| 81 }; | 85 }; |
| 82 | 86 |
| 83 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 87 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| OLD | NEW |