Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Side by Side Diff: content/browser/renderer_host/backing_store.h

Issue 10804031: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "ui/gfx/size.h" 13 #include "ui/gfx/size.h"
14 #include "ui/surface/transport_dib.h" 14 #include "ui/surface/transport_dib.h"
15 15
16 class RenderProcessHost; 16 class RenderProcessHost;
17 17
18 namespace gfx { 18 namespace gfx {
19 class Rect; 19 class Rect;
20 } 20 }
21 21
22 namespace content {
23 class RenderProcessHost;
24 class RenderWidgetHost;
25 }
26
27 namespace skia { 22 namespace skia {
28 class PlatformCanvas; 23 class PlatformCanvas;
29 } 24 }
30 25
26 namespace content {
27 class RenderProcessHost;
28 class RenderWidgetHost;
29
31 // Represents a backing store for the pixels in a RenderWidgetHost. 30 // Represents a backing store for the pixels in a RenderWidgetHost.
32 class CONTENT_EXPORT BackingStore { 31 class CONTENT_EXPORT BackingStore {
33 public: 32 public:
34 virtual ~BackingStore(); 33 virtual ~BackingStore();
35 34
36 content::RenderWidgetHost* render_widget_host() const { 35 RenderWidgetHost* render_widget_host() const {
37 return render_widget_host_; 36 return render_widget_host_;
38 } 37 }
39 const gfx::Size& size() { return size_; } 38 const gfx::Size& size() { return size_; }
40 39
41 // The number of bytes that this backing store consumes. The default 40 // The number of bytes that this backing store consumes. The default
42 // 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
43 // 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
44 // information about the color depth. 43 // information about the color depth.
45 virtual size_t MemorySize(); 44 virtual size_t MemorySize();
46 45
47 // 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
48 // 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
49 // the backingstore to be painted from the bitmap. All coordinates are in 48 // the backingstore to be painted from the bitmap. All coordinates are in
50 // DIPs. |scale_factor| contains the expected device scale factor of the 49 // DIPs. |scale_factor| contains the expected device scale factor of the
51 // backing store. 50 // backing store.
52 // 51 //
53 // PaintToBackingStore does not need to guarantee that this has happened by 52 // PaintToBackingStore does not need to guarantee that this has happened by
54 // the time it returns, in which case it will set |scheduled_callback| to 53 // the time it returns, in which case it will set |scheduled_callback| to
55 // true and will call |callback| when completed. 54 // true and will call |callback| when completed.
56 virtual void PaintToBackingStore( 55 virtual void PaintToBackingStore(
57 content::RenderProcessHost* process, 56 RenderProcessHost* process,
58 TransportDIB::Id bitmap, 57 TransportDIB::Id bitmap,
59 const gfx::Rect& bitmap_rect, 58 const gfx::Rect& bitmap_rect,
60 const std::vector<gfx::Rect>& copy_rects, 59 const std::vector<gfx::Rect>& copy_rects,
61 float scale_factor, 60 float scale_factor,
62 const base::Closure& completion_callback, 61 const base::Closure& completion_callback,
63 bool* scheduled_completion_callback) = 0; 62 bool* scheduled_completion_callback) = 0;
64 63
65 // Extracts the gives subset of the backing store and copies it to the given 64 // Extracts the gives subset of the backing store and copies it to the given
66 // PlatformCanvas. The PlatformCanvas should not be initialized. This function 65 // PlatformCanvas. The PlatformCanvas should not be initialized. This function
67 // will call initialize() with the correct size. The return value indicates 66 // will call initialize() with the correct size. The return value indicates
68 // success. 67 // success.
69 virtual bool CopyFromBackingStore(const gfx::Rect& rect, 68 virtual bool CopyFromBackingStore(const gfx::Rect& rect,
70 skia::PlatformCanvas* output) = 0; 69 skia::PlatformCanvas* output) = 0;
71 70
72 // Scrolls the contents of clip_rect in the backing store by dx or dy (but dx 71 // Scrolls the contents of clip_rect in the backing store by dx or dy (but dx
73 // and dy cannot both be non-zero). 72 // and dy cannot both be non-zero).
74 virtual void ScrollBackingStore(int dx, int dy, 73 virtual void ScrollBackingStore(int dx, int dy,
75 const gfx::Rect& clip_rect, 74 const gfx::Rect& clip_rect,
76 const gfx::Size& view_size) = 0; 75 const gfx::Size& view_size) = 0;
77 protected: 76 protected:
78 // Can only be constructed via subclasses. 77 // Can only be constructed via subclasses.
79 BackingStore(content::RenderWidgetHost* widget, const gfx::Size& size); 78 BackingStore(RenderWidgetHost* widget, const gfx::Size& size);
80 79
81 private: 80 private:
82 // The owner of this backing store. 81 // The owner of this backing store.
83 content::RenderWidgetHost* render_widget_host_; 82 RenderWidgetHost* render_widget_host_;
84 83
85 // The size of the backing store. 84 // The size of the backing store.
86 gfx::Size size_; 85 gfx::Size size_;
87 86
88 DISALLOW_COPY_AND_ASSIGN(BackingStore); 87 DISALLOW_COPY_AND_ASSIGN(BackingStore);
89 }; 88 };
90 89
90 } // namespace content
91
91 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ 92 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/async_resource_handler.cc ('k') | content/browser/renderer_host/backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698