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

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

Issue 21485: Bitmap transport (Closed)
Patch Set: Fix some mac crashes Created 11 years, 10 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_
6 #define CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/gfx/rect.h" 9 #include "base/gfx/rect.h"
10 #include "base/gfx/size.h" 10 #include "base/gfx/size.h"
11 #include "base/process.h" 11 #include "base/process.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/common/bitmap_wire_data.h"
14 #include "chrome/common/mru_cache.h" 13 #include "chrome/common/mru_cache.h"
15 14
16 #if defined(OS_WIN) 15 #if defined(OS_WIN)
17 #include <windows.h> 16 #include <windows.h>
18 #elif defined(OS_POSIX) 17 #elif defined(OS_POSIX)
19 #include "skia/ext/platform_canvas.h" 18 #include "skia/ext/platform_canvas.h"
20 #endif 19 #endif
21 20
22 class RenderWidgetHost; 21 class RenderWidgetHost;
22 class TransportDIB;
23 23
24 // BackingStore ---------------------------------------------------------------- 24 // BackingStore ----------------------------------------------------------------
25 25
26 // Represents a backing store for the pixels in a RenderWidgetHost. 26 // Represents a backing store for the pixels in a RenderWidgetHost.
27 class BackingStore { 27 class BackingStore {
28 public: 28 public:
29 explicit BackingStore(const gfx::Size& size); 29 explicit BackingStore(const gfx::Size& size);
30 ~BackingStore(); 30 ~BackingStore();
31 31
32 const gfx::Size& size() { return size_; } 32 const gfx::Size& size() { return size_; }
33 33
34 #if defined(OS_WIN) 34 #if defined(OS_WIN)
35 HDC hdc() { return hdc_; } 35 HDC hdc() { return hdc_; }
36 #elif defined(OS_POSIX) 36 #elif defined(OS_POSIX)
37 skia::PlatformCanvas* canvas() { return &canvas_; } 37 skia::PlatformCanvas* canvas() { return &canvas_; }
38 #endif 38 #endif
39 39
40 // Paints the bitmap from the renderer onto the backing store. 40 // Paints the bitmap from the renderer onto the backing store.
41 bool PaintRect(base::ProcessHandle process, 41 bool PaintRect(base::ProcessHandle process,
42 BitmapWireData bitmap_section, 42 TransportDIB* bitmap,
43 const gfx::Rect& bitmap_rect); 43 const gfx::Rect& bitmap_rect);
44 44
45 // Scrolls the given rect in the backing store, replacing the given region 45 // Scrolls the given rect in the backing store, replacing the given region
46 // identified by |bitmap_rect| by the bitmap in the file identified by the 46 // identified by |bitmap_rect| by the bitmap in the file identified by the
47 // given file handle. 47 // given file handle.
48 void ScrollRect(base::ProcessHandle process, 48 void ScrollRect(base::ProcessHandle process,
49 BitmapWireData bitmap, const gfx::Rect& bitmap_rect, 49 TransportDIB* bitmap, const gfx::Rect& bitmap_rect,
50 int dx, int dy, 50 int dx, int dy,
51 const gfx::Rect& clip_rect, 51 const gfx::Rect& clip_rect,
52 const gfx::Size& view_size); 52 const gfx::Size& view_size);
53 53
54 private: 54 private:
55 // The size of the backing store. 55 // The size of the backing store.
56 gfx::Size size_; 56 gfx::Size size_;
57 57
58 #if defined(OS_WIN) 58 #if defined(OS_WIN)
59 // Creates a dib conforming to the height/width/section parameters passed 59 // Creates a dib conforming to the height/width/section parameters passed
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // bitmap_section 106 // bitmap_section
107 // The bitmap section from the renderer. 107 // The bitmap section from the renderer.
108 // bitmap_rect 108 // bitmap_rect
109 // The rect to be painted into the backing store 109 // The rect to be painted into the backing store
110 // needs_full_paint 110 // needs_full_paint
111 // Set if we need to send out a request to paint the view 111 // Set if we need to send out a request to paint the view
112 // to the renderer. 112 // to the renderer.
113 static BackingStore* PrepareBackingStore(RenderWidgetHost* host, 113 static BackingStore* PrepareBackingStore(RenderWidgetHost* host,
114 const gfx::Rect& backing_store_rect, 114 const gfx::Rect& backing_store_rect,
115 base::ProcessHandle process_handle, 115 base::ProcessHandle process_handle,
116 BitmapWireData bitmap_section, 116 TransportDIB* bitmap,
117 const gfx::Rect& bitmap_rect, 117 const gfx::Rect& bitmap_rect,
118 bool* needs_full_paint); 118 bool* needs_full_paint);
119 119
120 // Returns a matching backing store for the host. 120 // Returns a matching backing store for the host.
121 // Returns NULL if we fail to find one. 121 // Returns NULL if we fail to find one.
122 static BackingStore* Lookup(RenderWidgetHost* host); 122 static BackingStore* Lookup(RenderWidgetHost* host);
123 123
124 // Removes the backing store for the host. 124 // Removes the backing store for the host.
125 static void RemoveBackingStore(RenderWidgetHost* host); 125 static void RemoveBackingStore(RenderWidgetHost* host);
126 126
127 private: 127 private:
128 // Not intended for instantiation. 128 // Not intended for instantiation.
129 BackingStoreManager() {} 129 BackingStoreManager() {}
130 130
131 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager); 131 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager);
132 }; 132 };
133 133
134 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ 134 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698