| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_ |
| 6 #define CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_ | 6 #define CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/hash.h" | 14 #include "base/hash.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/shared_memory.h" | 17 #include "base/memory/shared_memory.h" |
| 18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 19 #include "cc/resources/shared_bitmap_manager.h" | 19 #include "cc/resources/shared_bitmap_manager.h" |
| 20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
| 21 | 21 |
| 22 namespace BASE_HASH_NAMESPACE { | 22 namespace BASE_HASH_NAMESPACE { |
| 23 #if defined(COMPILER_GCC) | |
| 24 template <> | 23 template <> |
| 25 struct hash<cc::SharedBitmapId> { | 24 struct hash<cc::SharedBitmapId> { |
| 26 size_t operator()(const cc::SharedBitmapId& id) const { | 25 size_t operator()(const cc::SharedBitmapId& id) const { |
| 27 return base::Hash(reinterpret_cast<const char*>(id.name), sizeof(id.name)); | 26 return base::Hash(reinterpret_cast<const char*>(id.name), sizeof(id.name)); |
| 28 } | 27 } |
| 29 }; | 28 }; |
| 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 | 29 } // namespace BASE_HASH_NAMESPACE |
| 36 | 30 |
| 37 namespace content { | 31 namespace content { |
| 38 class BitmapData; | 32 class BitmapData; |
| 39 | 33 |
| 40 class CONTENT_EXPORT HostSharedBitmapManager : public cc::SharedBitmapManager { | 34 class CONTENT_EXPORT HostSharedBitmapManager : public cc::SharedBitmapManager { |
| 41 public: | 35 public: |
| 42 HostSharedBitmapManager(); | 36 HostSharedBitmapManager(); |
| 43 ~HostSharedBitmapManager() override; | 37 ~HostSharedBitmapManager() override; |
| 44 | 38 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 BitmapMap handle_map_; | 71 BitmapMap handle_map_; |
| 78 | 72 |
| 79 typedef base::hash_map<base::ProcessHandle, | 73 typedef base::hash_map<base::ProcessHandle, |
| 80 base::hash_set<cc::SharedBitmapId> > ProcessMap; | 74 base::hash_set<cc::SharedBitmapId> > ProcessMap; |
| 81 ProcessMap process_map_; | 75 ProcessMap process_map_; |
| 82 }; | 76 }; |
| 83 | 77 |
| 84 } // namespace content | 78 } // namespace content |
| 85 | 79 |
| 86 #endif // CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_ | 80 #endif // CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_ |
| OLD | NEW |