OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/eintr_wrapper.h" | 8 #include "base/eintr_wrapper.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "content/browser/renderer_host/render_process_host.h" | 10 #include "content/browser/renderer_host/render_process_host.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 if (i == allocated_dibs_.end()) | 288 if (i == allocated_dibs_.end()) |
289 return NULL; | 289 return NULL; |
290 | 290 |
291 base::FileDescriptor fd(dup(i->second), true); | 291 base::FileDescriptor fd(dup(i->second), true); |
292 return TransportDIB::Map(fd); | 292 return TransportDIB::Map(fd); |
293 } | 293 } |
294 | 294 |
295 void RenderWidgetHelper::AllocTransportDIB( | 295 void RenderWidgetHelper::AllocTransportDIB( |
296 size_t size, bool cache_in_browser, TransportDIB::Handle* result) { | 296 size_t size, bool cache_in_browser, TransportDIB::Handle* result) { |
297 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); | 297 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); |
298 if (!shared_memory->CreateAnonymous(size)) { | 298 if (!shared_memory->CreateAnonymous(size, false)) { |
299 result->fd = -1; | 299 result->fd = -1; |
300 result->auto_close = false; | 300 result->auto_close = false; |
301 return; | 301 return; |
302 } | 302 } |
303 | 303 |
304 shared_memory->GiveToProcess(0 /* pid, not needed */, result); | 304 shared_memory->GiveToProcess(0 /* pid, not needed */, result); |
305 | 305 |
306 if (cache_in_browser) { | 306 if (cache_in_browser) { |
307 // Keep a copy of the file descriptor around | 307 // Keep a copy of the file descriptor around |
308 base::AutoLock locked(allocated_dibs_lock_); | 308 base::AutoLock locked(allocated_dibs_lock_); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 gfx::PluginWindowHandle RenderWidgetHelper::LookupCompositingSurface( | 349 gfx::PluginWindowHandle RenderWidgetHelper::LookupCompositingSurface( |
350 int render_widget_id) { | 350 int render_widget_id) { |
351 base::AutoLock locked(view_compositing_surface_map_lock_); | 351 base::AutoLock locked(view_compositing_surface_map_lock_); |
352 ViewCompositingSurfaceMap::iterator it = | 352 ViewCompositingSurfaceMap::iterator it = |
353 view_compositing_surface_map_.find(render_widget_id); | 353 view_compositing_surface_map_.find(render_widget_id); |
354 if (it == view_compositing_surface_map_.end()) | 354 if (it == view_compositing_surface_map_.end()) |
355 return gfx::kNullPluginWindow; | 355 return gfx::kNullPluginWindow; |
356 | 356 |
357 return it->second; | 357 return it->second; |
358 } | 358 } |
OLD | NEW |