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

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, 10 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
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/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/shared_memory.h"
16 #include "base/synchronization/lock.h"
17 #include "cc/resources/shared_bitmap_manager.h"
18 #include "content/common/content_export.h"
19
20 struct SurfaceData;
21
22 namespace content {
23 class BitmapData;
24
25 class CONTENT_EXPORT HostSharedBitmapManager : public cc::SharedBitmapManager {
26 public:
27 HostSharedBitmapManager();
28 virtual ~HostSharedBitmapManager();
29
30 static HostSharedBitmapManager* current();
31
32 // cc::SharedBitmapManager implementation.
33 virtual scoped_ptr<cc::SharedBitmap> AllocateSharedBitmap(gfx::Size size)
34 OVERRIDE;
35 virtual scoped_ptr<cc::SharedBitmap> GetSharedBitmapFromId(
36 gfx::Size size,
37 const cc::SharedBitmapId&) OVERRIDE;
38 virtual scoped_ptr<cc::SharedBitmap> GetBitmapForSharedMemory(
39 base::SharedMemory*) OVERRIDE;
40
41 void AllocateSharedBitmapForChild(
42 base::ProcessHandle process_handle,
43 size_t buffer_size,
44 const cc::SharedBitmapId& id,
45 base::SharedMemoryHandle* shared_memory_handle);
46 void ChildAllocatedSharedBitmap(const base::SharedMemoryHandle& handle,
47 base::ProcessHandle process_handle,
48 const cc::SharedBitmapId& id);
49 void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id);
50 void ProcessRemoved(base::ProcessHandle process_handle);
51
52 private:
53 base::Lock lock_;
54
55 typedef std::map<cc::SharedBitmapId, scoped_refptr<BitmapData> > BitmapMap;
56 BitmapMap handle_map_;
57
58 typedef std::map<base::ProcessHandle, std::set<cc::SharedBitmapId> >
59 ProcessMap;
60 ProcessMap process_map_;
61 };
62
63 } // namespace content
64
65 #endif // CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698