Chromium Code Reviews| OLD | NEW |
|---|---|
| (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( | |
| 34 const gfx::Size& size) OVERRIDE; | |
| 35 virtual scoped_ptr<cc::SharedBitmap> GetSharedBitmapFromId( | |
| 36 const 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(size_t buffer_size, | |
| 47 const base::SharedMemoryHandle& handle, | |
| 48 base::ProcessHandle process_handle, | |
| 49 const cc::SharedBitmapId& id); | |
| 50 void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id); | |
| 51 void ProcessRemoved(base::ProcessHandle process_handle); | |
| 52 | |
| 53 private: | |
| 54 base::Lock lock_; | |
| 55 | |
| 56 typedef std::map<cc::SharedBitmapId, scoped_refptr<BitmapData> > BitmapMap; | |
|
piman
2014/02/18 21:38:20
nit: hash_map is probably faster (and uses less me
| |
| 57 BitmapMap handle_map_; | |
| 58 | |
| 59 typedef std::map<base::ProcessHandle, std::set<cc::SharedBitmapId> > | |
|
piman
2014/02/18 21:38:20
nit: hash_map, hash_set
| |
| 60 ProcessMap; | |
| 61 ProcessMap process_map_; | |
| 62 }; | |
| 63 | |
| 64 } // namespace content | |
| 65 | |
| 66 #endif // CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_ | |
| OLD | NEW |