| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Delete this RWH from the map if it is found. | 90 // Delete this RWH from the map if it is found. |
| 91 WidgetHelperMap& widget_map = g_widget_helpers.Get(); | 91 WidgetHelperMap& widget_map = g_widget_helpers.Get(); |
| 92 WidgetHelperMap::iterator it = widget_map.find(render_process_id_); | 92 WidgetHelperMap::iterator it = widget_map.find(render_process_id_); |
| 93 if (it != widget_map.end() && it->second == this) | 93 if (it != widget_map.end() && it->second == this) |
| 94 widget_map.erase(it); | 94 widget_map.erase(it); |
| 95 | 95 |
| 96 // The elements of pending_paints_ each hold an owning reference back to this | 96 // The elements of pending_paints_ each hold an owning reference back to this |
| 97 // object, so we should not be destroyed unless pending_paints_ is empty! | 97 // object, so we should not be destroyed unless pending_paints_ is empty! |
| 98 DCHECK(pending_paints_.empty()); | 98 DCHECK(pending_paints_.empty()); |
| 99 | 99 |
| 100 #if defined(OS_MACOSX) | 100 #if defined(OS_POSIX) && !defined(TOOLKIT_GTK) && !defined(OS_ANDROID) |
| 101 ClearAllocatedDIBs(); | 101 ClearAllocatedDIBs(); |
| 102 #endif | 102 #endif |
| 103 } | 103 } |
| 104 | 104 |
| 105 void RenderWidgetHelper::Init( | 105 void RenderWidgetHelper::Init( |
| 106 int render_process_id, | 106 int render_process_id, |
| 107 ResourceDispatcherHostImpl* resource_dispatcher_host) { | 107 ResourceDispatcherHostImpl* resource_dispatcher_host) { |
| 108 render_process_id_ = render_process_id; | 108 render_process_id_ = render_process_id; |
| 109 resource_dispatcher_host_ = resource_dispatcher_host; | 109 resource_dispatcher_host_ = resource_dispatcher_host; |
| 110 | 110 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 } | 328 } |
| 329 | 329 |
| 330 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int opener_id, | 330 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int opener_id, |
| 331 int route_id) { | 331 int route_id) { |
| 332 RenderViewHostImpl* host = RenderViewHostImpl::FromID( | 332 RenderViewHostImpl* host = RenderViewHostImpl::FromID( |
| 333 render_process_id_, opener_id); | 333 render_process_id_, opener_id); |
| 334 if (host) | 334 if (host) |
| 335 host->CreateNewFullscreenWidget(route_id); | 335 host->CreateNewFullscreenWidget(route_id); |
| 336 } | 336 } |
| 337 | 337 |
| 338 #if defined(OS_MACOSX) | 338 #if defined(OS_POSIX) && !defined(TOOLKIT_GTK) && !defined(OS_ANDROID) |
| 339 TransportDIB* RenderWidgetHelper::MapTransportDIB(TransportDIB::Id dib_id) { | 339 TransportDIB* RenderWidgetHelper::MapTransportDIB(TransportDIB::Id dib_id) { |
| 340 base::AutoLock locked(allocated_dibs_lock_); | 340 base::AutoLock locked(allocated_dibs_lock_); |
| 341 | 341 |
| 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); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |