| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "content/common/host_shared_bitmap_manager.h" | 5 #include "content/common/host_shared_bitmap_manager.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
| 10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const gfx::Size& size, | 55 const gfx::Size& size, |
| 56 const cc::SharedBitmapId& id) { | 56 const cc::SharedBitmapId& id) { |
| 57 base::AutoLock lock(lock_); | 57 base::AutoLock lock(lock_); |
| 58 BitmapMap::iterator it = handle_map_.find(id); | 58 BitmapMap::iterator it = handle_map_.find(id); |
| 59 if (it == handle_map_.end()) | 59 if (it == handle_map_.end()) |
| 60 return scoped_ptr<cc::SharedBitmap>(); | 60 return scoped_ptr<cc::SharedBitmap>(); |
| 61 | 61 |
| 62 BitmapData* data = it->second.get(); | 62 BitmapData* data = it->second.get(); |
| 63 | 63 |
| 64 size_t bitmap_size; | 64 size_t bitmap_size; |
| 65 if (!cc::SharedBitmap::GetSizeInBytes(size, &bitmap_size) || | 65 if (!cc::SharedBitmap::SizeInBytes(size, &bitmap_size) || |
| 66 bitmap_size > data->buffer_size) | 66 bitmap_size > data->buffer_size) |
| 67 return scoped_ptr<cc::SharedBitmap>(); | 67 return scoped_ptr<cc::SharedBitmap>(); |
| 68 | 68 |
| 69 if (!data->memory->memory()) { | 69 if (!data->memory->memory()) { |
| 70 TRACE_EVENT0("renderer_host", | 70 TRACE_EVENT0("renderer_host", |
| 71 "HostSharedBitmapManager::GetSharedBitmapFromId"); | 71 "HostSharedBitmapManager::GetSharedBitmapFromId"); |
| 72 if (!data->memory->Map(data->buffer_size)) { | 72 if (!data->memory->Map(data->buffer_size)) { |
| 73 return scoped_ptr<cc::SharedBitmap>(); | 73 return scoped_ptr<cc::SharedBitmap>(); |
| 74 } | 74 } |
| 75 } | 75 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 for (base::hash_set<cc::SharedBitmapId>::iterator it = res.begin(); | 160 for (base::hash_set<cc::SharedBitmapId>::iterator it = res.begin(); |
| 161 it != res.end(); | 161 it != res.end(); |
| 162 ++it) { | 162 ++it) { |
| 163 handle_map_.erase(*it); | 163 handle_map_.erase(*it); |
| 164 } | 164 } |
| 165 process_map_.erase(proc_it); | 165 process_map_.erase(proc_it); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace content | 168 } // namespace content |
| OLD | NEW |