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

Unified Diff: content/browser/compositor/software_output_device_win.h

Issue 1132133004: Share backing canvases between browser compositors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/compositor/software_output_device_win.h
diff --git a/content/browser/compositor/software_output_device_win.h b/content/browser/compositor/software_output_device_win.h
index 7063f207b00cfa446e5979cad1671c91bb465c9a..8b7fc160dc3cc182417dad56fae5aa6668009da0 100644
--- a/content/browser/compositor/software_output_device_win.h
+++ b/content/browser/compositor/software_output_device_win.h
@@ -5,13 +5,15 @@
#ifndef CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_
#define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_
+#include <vector>
+
#include "base/memory/scoped_ptr.h"
#include "cc/output/software_output_device.h"
#include <windows.h>
-namespace gfx {
-class Canvas;
+namespace base {
+class SharedMemory;
}
namespace ui {
@@ -19,10 +21,32 @@ class Compositor;
}
namespace content {
+class SoftwareOutputDeviceWin;
+
+class OutputDeviceBacking {
+ public:
+ OutputDeviceBacking();
+ ~OutputDeviceBacking();
+
+ void Resized();
+ void RegisterOutputDevice(SoftwareOutputDeviceWin* device);
+ void UnregisterOutputDevice(SoftwareOutputDeviceWin* device);
+ base::SharedMemory* GetSharedMemory();
+
+ private:
+ size_t GetMaxByteSize();
+
+ std::vector<SoftwareOutputDeviceWin*> devices_;
+ scoped_ptr<base::SharedMemory> backing_;
+ size_t created_byte_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(OutputDeviceBacking);
+};
class SoftwareOutputDeviceWin : public cc::SoftwareOutputDevice {
public:
- explicit SoftwareOutputDeviceWin(ui::Compositor* compositor);
+ SoftwareOutputDeviceWin(OutputDeviceBacking* backing,
+ ui::Compositor* compositor);
~SoftwareOutputDeviceWin() override;
void Resize(const gfx::Size& viewport_pixel_size,
@@ -30,11 +54,15 @@ class SoftwareOutputDeviceWin : public cc::SoftwareOutputDevice {
SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override;
void EndPaint(cc::SoftwareFrameData* frame_data) override;
+ gfx::Size viewport_pixel_size() const { return viewport_pixel_size_; }
+ void ReleaseContents();
+
private:
HWND hwnd_;
- BITMAPINFO bitmap_info_;
- scoped_ptr<gfx::Canvas> contents_;
+ skia::RefPtr<SkCanvas> contents_;
bool is_hwnd_composited_;
+ OutputDeviceBacking* backing_;
+ bool in_paint_;
DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceWin);
};

Powered by Google App Engine
This is Rietveld 408576698