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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/child_process_messages.h ('k') | content/common/host_shared_bitmap_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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.
4
5 #ifndef CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_
6 #define CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_
7
8 #include <map>
9 #include <set>
10
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/containers/hash_tables.h"
14 #include "base/hash.h"
15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/shared_memory.h"
18 #include "base/synchronization/lock.h"
19 #include "cc/resources/shared_bitmap_manager.h"
20 #include "content/common/content_export.h"
21
22 namespace BASE_HASH_NAMESPACE {
23 #if defined(COMPILER_GCC)
24 template <>
25 struct hash<cc::SharedBitmapId> {
26 size_t operator()(const cc::SharedBitmapId& id) const {
27 return base::Hash(reinterpret_cast<const char*>(id.name), sizeof(id.name));
28 }
29 };
30 #elif defined(COMPILER_MSVC)
31 inline std::size_t hash_value(const cc::SharedBitmapId& id) {
32 return base::Hash(reinterpret_cast<const char*>(id.name), sizeof(id.name));
33 }
34 #endif // COMPILER
35 } // namespace BASE_HASH_NAMESPACE
36
37 namespace content {
38 class BitmapData;
39
40 class CONTENT_EXPORT HostSharedBitmapManager : public cc::SharedBitmapManager {
41 public:
42 HostSharedBitmapManager();
43 virtual ~HostSharedBitmapManager();
44
45 static HostSharedBitmapManager* current();
46
47 // cc::SharedBitmapManager implementation.
48 virtual scoped_ptr<cc::SharedBitmap> AllocateSharedBitmap(
49 const gfx::Size& size) OVERRIDE;
50 virtual scoped_ptr<cc::SharedBitmap> GetSharedBitmapFromId(
51 const gfx::Size& size,
52 const cc::SharedBitmapId&) OVERRIDE;
53 virtual scoped_ptr<cc::SharedBitmap> GetBitmapForSharedMemory(
54 base::SharedMemory*) OVERRIDE;
55
56 void AllocateSharedBitmapForChild(
57 base::ProcessHandle process_handle,
58 size_t buffer_size,
59 const cc::SharedBitmapId& id,
60 base::SharedMemoryHandle* shared_memory_handle);
61 void ChildAllocatedSharedBitmap(size_t buffer_size,
62 const base::SharedMemoryHandle& handle,
63 base::ProcessHandle process_handle,
64 const cc::SharedBitmapId& id);
65 void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id);
66 void ProcessRemoved(base::ProcessHandle process_handle);
67
68 private:
69 base::Lock lock_;
70
71 typedef base::hash_map<cc::SharedBitmapId, scoped_refptr<BitmapData> >
72 BitmapMap;
73 BitmapMap handle_map_;
74
75 typedef base::hash_map<base::ProcessHandle,
76 base::hash_set<cc::SharedBitmapId> > ProcessMap;
77 ProcessMap process_map_;
78 };
79
80 } // namespace content
81
82 #endif // CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_
OLDNEW
« no previous file with comments | « content/common/child_process_messages.h ('k') | content/common/host_shared_bitmap_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698