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

Side by Side Diff: chrome/renderer/render_process.cc

Issue 39208: POSIX: Rewrite IPC's interaction with FileDescriptor (Closed)
Patch Set: Created 11 years, 9 months 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <objidl.h> 9 #include <objidl.h>
10 #include <mlang.h> 10 #include <mlang.h>
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 #endif 187 #endif
188 } 188 }
189 189
190 TransportDIB* RenderProcess::CreateTransportDIB(size_t size) { 190 TransportDIB* RenderProcess::CreateTransportDIB(size_t size) {
191 #if defined(OS_WIN) || defined(OS_LINUX) 191 #if defined(OS_WIN) || defined(OS_LINUX)
192 // Windows and Linux create transport DIBs inside the renderer 192 // Windows and Linux create transport DIBs inside the renderer
193 return TransportDIB::Create(size, sequence_number_++); 193 return TransportDIB::Create(size, sequence_number_++);
194 #elif defined(OS_MACOSX) // defined(OS_WIN) || defined(OS_LINUX) 194 #elif defined(OS_MACOSX) // defined(OS_WIN) || defined(OS_LINUX)
195 // Mac creates transport DIBs in the browser, so we need to do a sync IPC to 195 // Mac creates transport DIBs in the browser, so we need to do a sync IPC to
196 // get one. 196 // get one.
197 IPC::Maybe<TransportDIB::Handle> mhandle; 197 TransportDIB::Handle handle;
198 IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(size, &mhandle); 198 IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(size, &handle);
199 if (!child_thread()->Send(msg)) 199 if (!child_thread()->Send(msg))
200 return NULL; 200 return NULL;
201 if (!mhandle.valid) 201 if (handle.fd < 0)
202 return NULL; 202 return NULL;
203 return TransportDIB::Map(mhandle.value); 203 return TransportDIB::Map(handle);
204 #endif // defined(OS_MACOSX) 204 #endif // defined(OS_MACOSX)
205 } 205 }
206 206
207 void RenderProcess::FreeTransportDIB(TransportDIB* dib) { 207 void RenderProcess::FreeTransportDIB(TransportDIB* dib) {
208 if (!dib) 208 if (!dib)
209 return; 209 return;
210 210
211 #if defined(OS_MACOSX) 211 #if defined(OS_MACOSX)
212 // On Mac we need to tell the browser that it can drop a reference to the 212 // On Mac we need to tell the browser that it can drop a reference to the
213 // shared memory. 213 // shared memory.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 297 }
298 298
299 void RenderProcess::ClearTransportDIBCache() { 299 void RenderProcess::ClearTransportDIBCache() {
300 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { 300 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) {
301 if (shared_mem_cache_[i]) { 301 if (shared_mem_cache_[i]) {
302 FreeTransportDIB(shared_mem_cache_[i]); 302 FreeTransportDIB(shared_mem_cache_[i]);
303 shared_mem_cache_[i] = NULL; 303 shared_mem_cache_[i] = NULL;
304 } 304 }
305 } 305 }
306 } 306 }
OLDNEW
« chrome/common/ipc_message_utils.h ('K') | « chrome/common/render_messages_internal.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698