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

Unified Diff: content/renderer/gpu/compositor_software_output_device.h

Issue 12340015: [CLOSED] Big patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/renderer/gpu/compositor_software_output_device.h
diff --git a/content/renderer/gpu/compositor_software_output_device.h b/content/renderer/gpu/compositor_software_output_device.h
new file mode 100644
index 0000000000000000000000000000000000000000..af7537b354931765e12e4c84717dc3691b71e6c6
--- /dev/null
+++ b/content/renderer/gpu/compositor_software_output_device.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_
+#define CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "base/threading/non_thread_safe.h"
+#include "cc/software_output_device.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/surface/transport_dib.h"
+
+namespace content {
+
+// This class can be created only on the main thread, but then becomes pinned
+// to a fixed thread when bindToClient is called.
+class CompositorSoftwareOutputDevice
+ : NON_EXPORTED_BASE(public cc::SoftwareOutputDevice),
+ NON_EXPORTED_BASE(public base::NonThreadSafe) {
+public:
+ CompositorSoftwareOutputDevice();
+ virtual ~CompositorSoftwareOutputDevice();
+
+ virtual void Resize(const gfx::Size& size) OVERRIDE;
+
+ virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE;
+ virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE;
+
+ virtual void ReclaimDIB(TransportDIB::Handle handle) OVERRIDE;
+
+private:
+ size_t ViewportSizeInBytes() const {
+ return 4 * viewport_size_.GetArea();
+ }
+
+ TransportDIB* CreateDIB() {
+ TransportDIB* dib =
+ TransportDIB::Create(ViewportSizeInBytes(), sequence_num_++);
+ CHECK(dib);
+ return dib;
+ }
+
+ static const int kNumBuffers = 2;
+ int front_buffer_;
+ int last_buffer_;
+ int num_free_buffers_;
+ ScopedVector<TransportDIB> dibs_;
+ SkBitmap bitmap_; // TODO(skaslev) can we get rid of this?
+ uint32 sequence_num_;
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_
« no previous file with comments | « content/renderer/gpu/compositor_output_surface.cc ('k') | content/renderer/gpu/compositor_software_output_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698