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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 "HostSharedBitmapManager::GetSharedBitmapFromId"); | 110 "HostSharedBitmapManager::GetSharedBitmapFromId"); |
111 if (!data->memory->Map(data->buffer_size)) { | 111 if (!data->memory->Map(data->buffer_size)) { |
112 return scoped_ptr<cc::SharedBitmap>(); | 112 return scoped_ptr<cc::SharedBitmap>(); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 return make_scoped_ptr(new HostSharedBitmap( | 116 return make_scoped_ptr(new HostSharedBitmap( |
117 static_cast<uint8*>(data->memory->memory()), data, id, nullptr)); | 117 static_cast<uint8*>(data->memory->memory()), data, id, nullptr)); |
118 } | 118 } |
119 | 119 |
120 scoped_ptr<cc::SharedBitmap> HostSharedBitmapManager::GetBitmapForSharedMemory( | |
121 base::SharedMemory*) { | |
122 return scoped_ptr<cc::SharedBitmap>(); | |
123 } | |
124 | |
125 void HostSharedBitmapManager::ChildAllocatedSharedBitmap( | 120 void HostSharedBitmapManager::ChildAllocatedSharedBitmap( |
126 size_t buffer_size, | 121 size_t buffer_size, |
127 const base::SharedMemoryHandle& handle, | 122 const base::SharedMemoryHandle& handle, |
128 base::ProcessHandle process_handle, | 123 base::ProcessHandle process_handle, |
129 const cc::SharedBitmapId& id) { | 124 const cc::SharedBitmapId& id) { |
130 base::AutoLock lock(lock_); | 125 base::AutoLock lock(lock_); |
131 if (handle_map_.find(id) != handle_map_.end()) | 126 if (handle_map_.find(id) != handle_map_.end()) |
132 return; | 127 return; |
133 scoped_refptr<BitmapData> data( | 128 scoped_refptr<BitmapData> data( |
134 new BitmapData(process_handle, buffer_size)); | 129 new BitmapData(process_handle, buffer_size)); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 return handle_map_.size(); | 202 return handle_map_.size(); |
208 } | 203 } |
209 | 204 |
210 void HostSharedBitmapManager::FreeSharedMemoryFromMap( | 205 void HostSharedBitmapManager::FreeSharedMemoryFromMap( |
211 const cc::SharedBitmapId& id) { | 206 const cc::SharedBitmapId& id) { |
212 base::AutoLock lock(lock_); | 207 base::AutoLock lock(lock_); |
213 handle_map_.erase(id); | 208 handle_map_.erase(id); |
214 } | 209 } |
215 | 210 |
216 } // namespace content | 211 } // namespace content |
OLD | NEW |