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 #include "content/child/child_shared_bitmap_manager.h" | 5 #include "content/child/child_shared_bitmap_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Callers of this method are not prepared to handle failures during | 115 // Callers of this method are not prepared to handle failures during |
116 // shutdown. Exit immediately. This is expected behavior during the Fast | 116 // shutdown. Exit immediately. This is expected behavior during the Fast |
117 // Shutdown path, so use EXIT_SUCCESS. https://crbug.com/615121. | 117 // Shutdown path, so use EXIT_SUCCESS. https://crbug.com/615121. |
118 exit(EXIT_SUCCESS); | 118 exit(EXIT_SUCCESS); |
119 } | 119 } |
120 memory = base::MakeUnique<base::SharedMemory>(handle, false); | 120 memory = base::MakeUnique<base::SharedMemory>(handle, false); |
121 if (!memory->Map(memory_size)) | 121 if (!memory->Map(memory_size)) |
122 CollectMemoryUsageAndDie(size, memory_size); | 122 CollectMemoryUsageAndDie(size, memory_size); |
123 #else | 123 #else |
124 bool out_of_memory; | 124 bool out_of_memory; |
125 memory = ChildThreadImpl::AllocateSharedMemory(memory_size, sender_.get(), | 125 memory = ChildThreadImpl::AllocateSharedMemory(memory_size, &out_of_memory); |
126 &out_of_memory); | |
127 if (!memory) { | 126 if (!memory) { |
128 if (out_of_memory) { | 127 if (out_of_memory) { |
129 CollectMemoryUsageAndDie(size, memory_size); | 128 CollectMemoryUsageAndDie(size, memory_size); |
130 } else { | 129 } else { |
131 // Callers of this method are not prepared to handle failures during | 130 // Callers of this method are not prepared to handle failures during |
132 // shutdown. Exit immediately. This is expected behavior during the Fast | 131 // shutdown. Exit immediately. This is expected behavior during the Fast |
133 // Shutdown path, so use EXIT_SUCCESS. https://crbug.com/615121. | 132 // Shutdown path, so use EXIT_SUCCESS. https://crbug.com/615121. |
134 exit(EXIT_SUCCESS); | 133 exit(EXIT_SUCCESS); |
135 } | 134 } |
136 } | 135 } |
(...skipping 23 matching lines...) Expand all Loading... |
160 if (!mem->ShareToProcess(base::GetCurrentProcessHandle(), &handle_to_send)) | 159 if (!mem->ShareToProcess(base::GetCurrentProcessHandle(), &handle_to_send)) |
161 return std::unique_ptr<cc::SharedBitmap>(); | 160 return std::unique_ptr<cc::SharedBitmap>(); |
162 #endif | 161 #endif |
163 sender_->Send(new ChildProcessHostMsg_AllocatedSharedBitmap( | 162 sender_->Send(new ChildProcessHostMsg_AllocatedSharedBitmap( |
164 mem->mapped_size(), handle_to_send, id)); | 163 mem->mapped_size(), handle_to_send, id)); |
165 | 164 |
166 return base::MakeUnique<ChildSharedBitmap>(sender_, mem, id); | 165 return base::MakeUnique<ChildSharedBitmap>(sender_, mem, id); |
167 } | 166 } |
168 | 167 |
169 } // namespace content | 168 } // namespace content |
OLD | NEW |