| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "cc/test/test_shared_bitmap_manager.h" | 5 #include "cc/test/test_shared_bitmap_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 scoped_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId( | 57 scoped_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId( |
| 58 const gfx::Size&, | 58 const gfx::Size&, |
| 59 const SharedBitmapId& id) { | 59 const SharedBitmapId& id) { |
| 60 base::AutoLock lock(lock_); | 60 base::AutoLock lock(lock_); |
| 61 if (bitmap_map_.find(id) == bitmap_map_.end()) | 61 if (bitmap_map_.find(id) == bitmap_map_.end()) |
| 62 return nullptr; | 62 return nullptr; |
| 63 return make_scoped_ptr(new UnownedSharedBitmap(bitmap_map_[id], id)); | 63 return make_scoped_ptr(new UnownedSharedBitmap(bitmap_map_[id], id)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 scoped_ptr<SharedBitmap> TestSharedBitmapManager::GetBitmapForSharedMemory( | |
| 67 base::SharedMemory* memory) { | |
| 68 base::AutoLock lock(lock_); | |
| 69 SharedBitmapId id = SharedBitmap::GenerateId(); | |
| 70 bitmap_map_[id] = memory; | |
| 71 return make_scoped_ptr(new UnownedSharedBitmap(memory, id)); | |
| 72 } | |
| 73 | |
| 74 } // namespace cc | 66 } // namespace cc |
| OLD | NEW |