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

Unified Diff: content/common/host_shared_bitmap_manager.h

Issue 148243013: Add shared bitmap managers for browser and renderer processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/common/host_shared_bitmap_manager.h
diff --git a/content/common/host_shared_bitmap_manager.h b/content/common/host_shared_bitmap_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..8ec13cbf63d297b6cb68dd288407f0be053b24b8
--- /dev/null
+++ b/content/common/host_shared_bitmap_manager.h
@@ -0,0 +1,65 @@
+// 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_COMMON_HOST_SHARED_BITMAP_MANAGER_H_
+#define CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_
+
+#include <map>
+#include <set>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/shared_memory.h"
+#include "base/synchronization/lock.h"
+#include "cc/resources/shared_bitmap_manager.h"
+#include "content/common/content_export.h"
+
+struct SurfaceData;
+
+namespace content {
+class BitmapData;
+
+class CONTENT_EXPORT HostSharedBitmapManager : public cc::SharedBitmapManager {
+ public:
+ HostSharedBitmapManager();
+ virtual ~HostSharedBitmapManager();
+
+ static HostSharedBitmapManager* current();
+
+ // cc::SharedBitmapManager implementation.
+ virtual scoped_ptr<cc::SharedBitmap> AllocateSharedBitmap(gfx::Size size)
+ OVERRIDE;
+ virtual scoped_ptr<cc::SharedBitmap> GetSharedBitmapFromId(
+ gfx::Size size,
+ const cc::SharedBitmapId&) OVERRIDE;
+ virtual scoped_ptr<cc::SharedBitmap> GetBitmapForSharedMemory(
+ base::SharedMemory*) OVERRIDE;
+
+ void AllocateSharedBitmapForChild(
+ base::ProcessHandle process_handle,
+ size_t buffer_size,
+ const cc::SharedBitmapId& id,
+ base::SharedMemoryHandle* shared_memory_handle);
+ void ChildAllocatedSharedBitmap(const base::SharedMemoryHandle& handle,
+ base::ProcessHandle process_handle,
+ const cc::SharedBitmapId& id);
+ void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id);
+ void ProcessRemoved(base::ProcessHandle process_handle);
+
+ private:
+ base::Lock lock_;
+
+ typedef std::map<cc::SharedBitmapId, scoped_refptr<BitmapData> > BitmapMap;
+ BitmapMap handle_map_;
+
+ typedef std::map<base::ProcessHandle, std::set<cc::SharedBitmapId> >
+ ProcessMap;
+ ProcessMap process_map_;
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698