sandbox/linux/bpf_dsl: eliminate implicit dependency on C++ compiler behavior
[chromium-blink-merge.git] / content / browser / compositor / software_output_device_win.h
blob3f444ae96e08f2696d9f844362ce4f669148b522
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_
6 #define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_
8 #include <vector>
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/output/software_output_device.h"
13 #include <windows.h>
15 namespace base {
16 class SharedMemory;
19 namespace ui {
20 class Compositor;
23 namespace content {
24 class SoftwareOutputDeviceWin;
26 class OutputDeviceBacking {
27 public:
28 OutputDeviceBacking();
29 ~OutputDeviceBacking();
31 void Resized();
32 void RegisterOutputDevice(SoftwareOutputDeviceWin* device);
33 void UnregisterOutputDevice(SoftwareOutputDeviceWin* device);
34 base::SharedMemory* GetSharedMemory();
36 private:
37 size_t GetMaxByteSize();
39 std::vector<SoftwareOutputDeviceWin*> devices_;
40 scoped_ptr<base::SharedMemory> backing_;
41 size_t created_byte_size_;
43 DISALLOW_COPY_AND_ASSIGN(OutputDeviceBacking);
46 class SoftwareOutputDeviceWin : public cc::SoftwareOutputDevice {
47 public:
48 SoftwareOutputDeviceWin(OutputDeviceBacking* backing,
49 ui::Compositor* compositor);
50 ~SoftwareOutputDeviceWin() override;
52 void Resize(const gfx::Size& viewport_pixel_size,
53 float scale_factor) override;
54 SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override;
55 void EndPaint() override;
57 gfx::Size viewport_pixel_size() const { return viewport_pixel_size_; }
58 void ReleaseContents();
60 private:
61 HWND hwnd_;
62 skia::RefPtr<SkCanvas> contents_;
63 bool is_hwnd_composited_;
64 OutputDeviceBacking* backing_;
65 bool in_paint_;
67 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceWin);
70 } // namespace content
72 #endif // CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_