| 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/eintr_wrapper.h" | 9 #include "base/eintr_wrapper.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 11 #include "base/threading/thread_restrictions.h" |
| 11 #include "content/browser/gpu/gpu_surface_tracker.h" | 12 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 12 #include "content/browser/renderer_host/render_process_host_impl.h" | 13 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 13 #include "content/browser/renderer_host/render_view_host_impl.h" | 14 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 14 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 15 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
| 15 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
| 16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 17 | 18 |
| 18 using content::BrowserThread; | 19 using content::BrowserThread; |
| 19 using content::RenderViewHostImpl; | 20 using content::RenderViewHostImpl; |
| 20 using content::ResourceDispatcherHostImpl; | 21 using content::ResourceDispatcherHostImpl; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 DCHECK(msg->routing_id() == render_widget_id); | 142 DCHECK(msg->routing_id() == render_widget_id); |
| 142 return true; | 143 return true; |
| 143 } | 144 } |
| 144 | 145 |
| 145 // Calculate the maximum amount of time that we are willing to sleep. | 146 // Calculate the maximum amount of time that we are willing to sleep. |
| 146 base::TimeDelta max_sleep_time = | 147 base::TimeDelta max_sleep_time = |
| 147 max_delay - (base::TimeTicks::Now() - time_start); | 148 max_delay - (base::TimeTicks::Now() - time_start); |
| 148 if (max_sleep_time <= base::TimeDelta::FromMilliseconds(0)) | 149 if (max_sleep_time <= base::TimeDelta::FromMilliseconds(0)) |
| 149 break; | 150 break; |
| 150 | 151 |
| 152 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 151 event_.TimedWait(max_sleep_time); | 153 event_.TimedWait(max_sleep_time); |
| 152 } | 154 } |
| 153 | 155 |
| 154 return false; | 156 return false; |
| 155 } | 157 } |
| 156 | 158 |
| 157 void RenderWidgetHelper::DidReceiveUpdateMsg(const IPC::Message& msg) { | 159 void RenderWidgetHelper::DidReceiveUpdateMsg(const IPC::Message& msg) { |
| 158 int render_widget_id = msg.routing_id(); | 160 int render_widget_id = msg.routing_id(); |
| 159 | 161 |
| 160 UpdateMsgProxy* proxy = new UpdateMsgProxy(this, msg); | 162 UpdateMsgProxy* proxy = new UpdateMsgProxy(this, msg); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 void RenderWidgetHelper::ClearAllocatedDIBs() { | 358 void RenderWidgetHelper::ClearAllocatedDIBs() { |
| 357 for (std::map<TransportDIB::Id, int>::iterator | 359 for (std::map<TransportDIB::Id, int>::iterator |
| 358 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { | 360 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { |
| 359 if (HANDLE_EINTR(close(i->second)) < 0) | 361 if (HANDLE_EINTR(close(i->second)) < 0) |
| 360 PLOG(ERROR) << "close: " << i->first; | 362 PLOG(ERROR) << "close: " << i->first; |
| 361 } | 363 } |
| 362 | 364 |
| 363 allocated_dibs_.clear(); | 365 allocated_dibs_.clear(); |
| 364 } | 366 } |
| 365 #endif | 367 #endif |
| OLD | NEW |