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

Unified Diff: components/exo/shared_memory.h

Issue 1412093006: components: Add Exosphere component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove some ifdefs Created 5 years, 1 month 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
« no previous file with comments | « components/exo/display_unittest.cc ('k') | components/exo/shared_memory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/shared_memory.h
diff --git a/components/exo/shared_memory.h b/components/exo/shared_memory.h
new file mode 100644
index 0000000000000000000000000000000000000000..53ba8ce1a207e2dcaed591a9f783cfd4fa298ef2
--- /dev/null
+++ b/components/exo/shared_memory.h
@@ -0,0 +1,42 @@
+// Copyright 2015 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 COMPONENTS_EXO_SHARED_MEMORY_H_
+#define COMPONENTS_EXO_SHARED_MEMORY_H_
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/shared_memory.h"
+#include "ui/gfx/buffer_types.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace exo {
+class Buffer;
+
+// Shared memory abstraction. Provides a wrapper around base::SharedMemory
+// with functionality to create buffers from the memory to use for display.
+class SharedMemory {
+ public:
+ explicit SharedMemory(const base::SharedMemoryHandle& handle);
+ ~SharedMemory();
+
+ // Creates a buffer from the shared memory. The buffer is created offset bytes
+ // into the memory and has width and height as specified. The stride
+ // arguments specifies the number of bytes from beginning of one row to the
+ // beginning of the next. The format is the pixel format of the buffer and
+ // must be one of RGBX_8888, RGBA_8888, BGRX_8888, BGRA_8888.
+ scoped_ptr<Buffer> CreateBuffer(const gfx::Size& size,
+ gfx::BufferFormat format,
+ unsigned offset,
+ int stride);
+
+ private:
+ base::SharedMemory shared_memory_;
+
+ DISALLOW_COPY_AND_ASSIGN(SharedMemory);
+};
+
+} // namespace exo
+
+#endif // COMPONENTS_EXO_SHARED_MEMORY_H_
« no previous file with comments | « components/exo/display_unittest.cc ('k') | components/exo/shared_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698