Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: content/child/child_thread_impl.h

Issue 2544953002: content: Some code cleanup related to shared memory allocation. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 const service_manager::ServiceInfo& GetChildServiceInfo() const; 108 const service_manager::ServiceInfo& GetChildServiceInfo() const;
109 const service_manager::ServiceInfo& GetBrowserServiceInfo() const; 109 const service_manager::ServiceInfo& GetBrowserServiceInfo() const;
110 bool IsConnectedToBrowser() const; 110 bool IsConnectedToBrowser() const;
111 111
112 IPC::SyncChannel* channel() { return channel_.get(); } 112 IPC::SyncChannel* channel() { return channel_.get(); }
113 113
114 IPC::MessageRouter* GetRouter(); 114 IPC::MessageRouter* GetRouter();
115 115
116 mojom::RouteProvider* GetRemoteRouteProvider(); 116 mojom::RouteProvider* GetRemoteRouteProvider();
117 117
118 // Allocates a block of shared memory of the given size. Returns NULL on 118 // A static variant that can be called on background threads.
119 // failure.
120 // Note: On posix, this requires a sync IPC to the browser process,
121 // but on windows the child process directly allocates the block.
122 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(size_t buf_size);
123
124 // A static variant that can be called on background threads provided
125 // the |sender| passed in is safe to use on background threads.
126 // |out_of_memory| is an output variable populated on failure which tells the 119 // |out_of_memory| is an output variable populated on failure which tells the
127 // caller whether the failure was caused by an out of memory error. 120 // caller whether the failure was caused by an out of memory error.
128 static std::unique_ptr<base::SharedMemory> AllocateSharedMemory( 121 static std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
129 size_t buf_size, 122 size_t buf_size,
130 IPC::Sender* sender, 123 bool* out_of_memory = nullptr);
131 bool* out_of_memory);
132 124
133 #if defined(OS_LINUX) 125 #if defined(OS_LINUX)
134 void SetThreadPriority(base::PlatformThreadId id, 126 void SetThreadPriority(base::PlatformThreadId id,
135 base::ThreadPriority priority); 127 base::ThreadPriority priority);
136 #endif 128 #endif
137 129
138 ChildSharedBitmapManager* shared_bitmap_manager() const { 130 ChildSharedBitmapManager* shared_bitmap_manager() const {
139 return shared_bitmap_manager_.get(); 131 return shared_bitmap_manager_.get();
140 } 132 }
141 133
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 369
378 private: 370 private:
379 struct Options options_; 371 struct Options options_;
380 372
381 DISALLOW_COPY_AND_ASSIGN(Builder); 373 DISALLOW_COPY_AND_ASSIGN(Builder);
382 }; 374 };
383 375
384 } // namespace content 376 } // namespace content
385 377
386 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ 378 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698