OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHILD_CHILD_THREAD_IMPL_H_ | 5 #ifndef CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 IPC::MessageRouter* GetRouter(); | 96 IPC::MessageRouter* GetRouter(); |
97 | 97 |
98 // Allocates a block of shared memory of the given size. Returns NULL on | 98 // Allocates a block of shared memory of the given size. Returns NULL on |
99 // failure. | 99 // failure. |
100 // Note: On posix, this requires a sync IPC to the browser process, | 100 // Note: On posix, this requires a sync IPC to the browser process, |
101 // but on windows the child process directly allocates the block. | 101 // but on windows the child process directly allocates the block. |
102 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(size_t buf_size); | 102 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(size_t buf_size); |
103 | 103 |
104 // A static variant that can be called on background threads provided | 104 // A static variant that can be called on background threads provided |
105 // the |sender| passed in is safe to use on background threads. | 105 // the |sender| passed in is safe to use on background threads. |
| 106 // |out_of_memory| is an output variable populated on failure which tells the |
| 107 // caller whether the failure was caused by an out of memory error. |
106 static std::unique_ptr<base::SharedMemory> AllocateSharedMemory( | 108 static std::unique_ptr<base::SharedMemory> AllocateSharedMemory( |
107 size_t buf_size, | 109 size_t buf_size, |
108 IPC::Sender* sender); | 110 IPC::Sender* sender, |
| 111 bool* out_of_memory); |
109 | 112 |
110 ChildSharedBitmapManager* shared_bitmap_manager() const { | 113 ChildSharedBitmapManager* shared_bitmap_manager() const { |
111 return shared_bitmap_manager_.get(); | 114 return shared_bitmap_manager_.get(); |
112 } | 115 } |
113 | 116 |
114 ChildGpuMemoryBufferManager* gpu_memory_buffer_manager() const { | 117 ChildGpuMemoryBufferManager* gpu_memory_buffer_manager() const { |
115 return gpu_memory_buffer_manager_.get(); | 118 return gpu_memory_buffer_manager_.get(); |
116 } | 119 } |
117 | 120 |
118 ChildDiscardableSharedMemoryManager* discardable_shared_memory_manager() | 121 ChildDiscardableSharedMemoryManager* discardable_shared_memory_manager() |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 326 |
324 private: | 327 private: |
325 struct Options options_; | 328 struct Options options_; |
326 | 329 |
327 DISALLOW_COPY_AND_ASSIGN(Builder); | 330 DISALLOW_COPY_AND_ASSIGN(Builder); |
328 }; | 331 }; |
329 | 332 |
330 } // namespace content | 333 } // namespace content |
331 | 334 |
332 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 335 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
OLD | NEW |