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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int opener_id, | 337 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int opener_id, |
338 int route_id) { | 338 int route_id) { |
339 RenderViewHostImpl* host = RenderViewHostImpl::FromID( | 339 RenderViewHostImpl* host = RenderViewHostImpl::FromID( |
340 render_process_id_, opener_id); | 340 render_process_id_, opener_id); |
341 if (host) | 341 if (host) |
342 host->CreateNewFullscreenWidget(route_id); | 342 host->CreateNewFullscreenWidget(route_id); |
343 } | 343 } |
344 | 344 |
345 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 345 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
346 TransportDIB* RenderWidgetHelper::MapTransportDIB(TransportDIB::Id dib_id) { | |
347 base::AutoLock locked(allocated_dibs_lock_); | |
348 | |
349 const std::map<TransportDIB::Id, int>::iterator | |
350 i = allocated_dibs_.find(dib_id); | |
351 if (i == allocated_dibs_.end()) | |
352 return NULL; | |
353 | |
354 base::FileDescriptor fd(dup(i->second), true); | |
355 return TransportDIB::Map(fd); | |
356 } | |
357 | |
358 void RenderWidgetHelper::AllocTransportDIB(uint32 size, | 346 void RenderWidgetHelper::AllocTransportDIB(uint32 size, |
359 bool cache_in_browser, | 347 bool cache_in_browser, |
360 TransportDIB::Handle* result) { | 348 TransportDIB::Handle* result) { |
361 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); | 349 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); |
362 if (!shared_memory->CreateAnonymous(size)) { | 350 if (!shared_memory->CreateAnonymous(size)) { |
363 result->fd = -1; | 351 result->fd = -1; |
364 result->auto_close = false; | 352 result->auto_close = false; |
365 return; | 353 return; |
366 } | 354 } |
367 | 355 |
(...skipping 26 matching lines...) Expand all Loading... |
394 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { | 382 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { |
395 if (IGNORE_EINTR(close(i->second)) < 0) | 383 if (IGNORE_EINTR(close(i->second)) < 0) |
396 PLOG(ERROR) << "close: " << i->first; | 384 PLOG(ERROR) << "close: " << i->first; |
397 } | 385 } |
398 | 386 |
399 allocated_dibs_.clear(); | 387 allocated_dibs_.clear(); |
400 } | 388 } |
401 #endif | 389 #endif |
402 | 390 |
403 } // namespace content | 391 } // namespace content |
OLD | NEW |