Chromium Code Reviews| 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 #include "content/browser/renderer_host/render_widget_helper.h" | 5 #include "content/browser/renderer_host/render_widget_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/posix/eintr_wrapper.h" | 10 #include "base/posix/eintr_wrapper.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 const std::map<TransportDIB::Id, int>::iterator | 342 const std::map<TransportDIB::Id, int>::iterator |
| 343 i = allocated_dibs_.find(dib_id); | 343 i = allocated_dibs_.find(dib_id); |
| 344 if (i == allocated_dibs_.end()) | 344 if (i == allocated_dibs_.end()) |
| 345 return NULL; | 345 return NULL; |
| 346 | 346 |
| 347 base::FileDescriptor fd(dup(i->second), true); | 347 base::FileDescriptor fd(dup(i->second), true); |
| 348 return TransportDIB::Map(fd); | 348 return TransportDIB::Map(fd); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void RenderWidgetHelper::AllocTransportDIB( | 351 void RenderWidgetHelper::AllocTransportDIB( |
| 352 size_t size, bool cache_in_browser, TransportDIB::Handle* result) { | 352 uint32_t size, bool cache_in_browser, TransportDIB::Handle* result) { |
|
sky
2013/05/31 21:51:20
nit: when you wrap, one paramter per line.
palmer
2013/05/31 22:05:18
Done.
| |
| 353 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); | 353 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); |
| 354 if (!shared_memory->CreateAnonymous(size)) { | 354 if (!shared_memory->CreateAnonymous(size)) { |
| 355 result->fd = -1; | 355 result->fd = -1; |
| 356 result->auto_close = false; | 356 result->auto_close = false; |
| 357 return; | 357 return; |
| 358 } | 358 } |
| 359 | 359 |
| 360 shared_memory->GiveToProcess(0 /* pid, not needed */, result); | 360 shared_memory->GiveToProcess(0 /* pid, not needed */, result); |
| 361 | 361 |
| 362 if (cache_in_browser) { | 362 if (cache_in_browser) { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 386 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { | 386 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { |
| 387 if (HANDLE_EINTR(close(i->second)) < 0) | 387 if (HANDLE_EINTR(close(i->second)) < 0) |
| 388 PLOG(ERROR) << "close: " << i->first; | 388 PLOG(ERROR) << "close: " << i->first; |
| 389 } | 389 } |
| 390 | 390 |
| 391 allocated_dibs_.clear(); | 391 allocated_dibs_.clear(); |
| 392 } | 392 } |
| 393 #endif | 393 #endif |
| 394 | 394 |
| 395 } // namespace content | 395 } // namespace content |
| OLD | NEW |