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

Side by Side Diff: content/browser/renderer_host/backing_store_manager.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_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MANAGER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MANAGER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MANAGER_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 "base/process.h" 12 #include "base/process.h"
13 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
14 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
15 #include "ui/surface/transport_dib.h" 15 #include "ui/surface/transport_dib.h"
16 16
17 namespace content {
17 class BackingStore; 18 class BackingStore;
18
19 namespace content {
20 class RenderWidgetHost; 19 class RenderWidgetHost;
21 }
22 20
23 // This class manages backing stores in the browsr. Every RenderWidgetHost is 21 // This class manages backing stores in the browsr. Every RenderWidgetHost is
24 // associated with a backing store which it requests from this class. The 22 // associated with a backing store which it requests from this class. The
25 // hosts don't maintain any references to the backing stores. These backing 23 // hosts don't maintain any references to the backing stores. These backing
26 // stores are maintained in a cache which can be trimmed as needed. 24 // stores are maintained in a cache which can be trimmed as needed.
27 class BackingStoreManager { 25 class BackingStoreManager {
28 public: 26 public:
29 // Returns a backing store which matches the desired dimensions. 27 // Returns a backing store which matches the desired dimensions.
30 // 28 //
31 // backing_store_rect 29 // backing_store_rect
32 // The desired backing store dimensions. 30 // The desired backing store dimensions.
33 // Returns a pointer to the backing store on success, NULL on failure. 31 // Returns a pointer to the backing store on success, NULL on failure.
34 static BackingStore* GetBackingStore(content::RenderWidgetHost* host, 32 static BackingStore* GetBackingStore(RenderWidgetHost* host,
35 const gfx::Size& desired_size); 33 const gfx::Size& desired_size);
36 34
37 // Makes a backing store which is fully ready for consumption, i.e. the 35 // Makes a backing store which is fully ready for consumption, i.e. the
38 // bitmap from the renderer has been copied into the backing store. 36 // bitmap from the renderer has been copied into the backing store.
39 // 37 //
40 // backing_store_size 38 // backing_store_size
41 // The desired backing store dimensions, in DIPs. 39 // The desired backing store dimensions, in DIPs.
42 // bitmap_section 40 // bitmap_section
43 // The bitmap section from the renderer. 41 // The bitmap section from the renderer.
44 // bitmap_rect 42 // bitmap_rect
45 // The rect to be painted into the backing store, in DIPs. 43 // The rect to be painted into the backing store, in DIPs.
46 // scale_factor 44 // scale_factor
47 // The device scale factor the backing store is expected to be at. 45 // The device scale factor the backing store is expected to be at.
48 // If the backing store's device scale factor doesn't match, it will need 46 // If the backing store's device scale factor doesn't match, it will need
49 // to scale |bitmap| at paint time. This will only be out of sync with the 47 // to scale |bitmap| at paint time. This will only be out of sync with the
50 // backing store scale factor for a few frames, right after device scale 48 // backing store scale factor for a few frames, right after device scale
51 // changes. 49 // changes.
52 // needs_full_paint 50 // needs_full_paint
53 // Set if we need to send out a request to paint the view 51 // Set if we need to send out a request to paint the view
54 // to the renderer. 52 // to the renderer.
55 static void PrepareBackingStore( 53 static void PrepareBackingStore(
56 content::RenderWidgetHost* host, 54 RenderWidgetHost* host,
57 const gfx::Size& backing_store_size, 55 const gfx::Size& backing_store_size,
58 TransportDIB::Id bitmap, 56 TransportDIB::Id bitmap,
59 const gfx::Rect& bitmap_rect, 57 const gfx::Rect& bitmap_rect,
60 const std::vector<gfx::Rect>& copy_rects, 58 const std::vector<gfx::Rect>& copy_rects,
61 float scale_factor, 59 float scale_factor,
62 const base::Closure& completion_callback, 60 const base::Closure& completion_callback,
63 bool* needs_full_paint, 61 bool* needs_full_paint,
64 bool* scheduled_completion_callback); 62 bool* scheduled_completion_callback);
65 63
66 // Returns a matching backing store for the host. 64 // Returns a matching backing store for the host.
67 // Returns NULL if we fail to find one. 65 // Returns NULL if we fail to find one.
68 static BackingStore* Lookup(content::RenderWidgetHost* host); 66 static BackingStore* Lookup(RenderWidgetHost* host);
69 67
70 // Removes the backing store for the host. 68 // Removes the backing store for the host.
71 static void RemoveBackingStore(content::RenderWidgetHost* host); 69 static void RemoveBackingStore(RenderWidgetHost* host);
72 70
73 // Removes all backing stores. 71 // Removes all backing stores.
74 static void RemoveAllBackingStores(); 72 static void RemoveAllBackingStores();
75 73
76 // Current size in bytes of the backing store cache. 74 // Current size in bytes of the backing store cache.
77 static size_t MemorySize(); 75 static size_t MemorySize();
78 76
79 private: 77 private:
80 // Not intended for instantiation. 78 // Not intended for instantiation.
81 BackingStoreManager() {} 79 BackingStoreManager() {}
82 80
83 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager); 81 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager);
84 }; 82 };
85 83
84 } // namespace content
85
86 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MANAGER_H_ 86 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/backing_store_mac.mm ('k') | content/browser/renderer_host/backing_store_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698