| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_resize_helper.h" | 5 #include "content/browser/renderer_host/render_widget_resize_helper.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 10 #include "content/browser/renderer_host/render_process_host_impl.h" | 10 #include "content/browser/renderer_host/render_process_host_impl.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 WrappedTask* task, | 65 WrappedTask* task, |
| 66 base::TimeDelta delay); | 66 base::TimeDelta delay); |
| 67 | 67 |
| 68 // Wait at most |max_delay| to run an enqueued task. | 68 // Wait at most |max_delay| to run an enqueued task. |
| 69 bool WaitForSingleWrappedTaskToRun(const base::TimeDelta& max_delay); | 69 bool WaitForSingleWrappedTaskToRun(const base::TimeDelta& max_delay); |
| 70 | 70 |
| 71 // Remove a wrapped task from the queue. | 71 // Remove a wrapped task from the queue. |
| 72 void RemoveWrappedTaskFromQueue(WrappedTask* task); | 72 void RemoveWrappedTaskFromQueue(WrappedTask* task); |
| 73 | 73 |
| 74 // base::SingleThreadTaskRunner implementation: | 74 // base::SingleThreadTaskRunner implementation: |
| 75 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | 75 bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 76 const base::Closure& task, | 76 const base::Closure& task, |
| 77 base::TimeDelta delay) override; | 77 base::TimeDelta delay) override; |
| 78 | 78 |
| 79 virtual bool PostNonNestableDelayedTask( | 79 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
| 80 const tracked_objects::Location& from_here, | 80 const base::Closure& task, |
| 81 const base::Closure& task, | 81 base::TimeDelta delay) override; |
| 82 base::TimeDelta delay) override; | |
| 83 | 82 |
| 84 virtual bool RunsTasksOnCurrentThread() const override; | 83 bool RunsTasksOnCurrentThread() const override; |
| 85 | 84 |
| 86 private: | 85 private: |
| 87 friend class WrappedTask; | 86 friend class WrappedTask; |
| 88 | 87 |
| 89 virtual ~PumpableTaskRunner(); | 88 ~PumpableTaskRunner() override; |
| 90 | 89 |
| 91 // A queue of live messages. Must hold |task_queue_lock_| to access. Tasks | 90 // A queue of live messages. Must hold |task_queue_lock_| to access. Tasks |
| 92 // are added only on the IO thread and removed only on the UI thread. The | 91 // are added only on the IO thread and removed only on the UI thread. The |
| 93 // WrappedTask objects are removed from the queue when they are run (by | 92 // WrappedTask objects are removed from the queue when they are run (by |
| 94 // |target_task_runner_| or by a call to WaitForSingleWrappedTaskToRun | 93 // |target_task_runner_| or by a call to WaitForSingleWrappedTaskToRun |
| 95 // removing them out of the queue, or by TaskRunner when it is destroyed). | 94 // removing them out of the queue, or by TaskRunner when it is destroyed). |
| 96 WrappedTaskQueue task_queue_; | 95 WrappedTaskQueue task_queue_; |
| 97 base::Lock task_queue_lock_; | 96 base::Lock task_queue_lock_; |
| 98 | 97 |
| 99 // Event used to wake up the UI thread if it is sleeping in | 98 // Event used to wake up the UI thread if it is sleeping in |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 347 |
| 349 // static | 348 // static |
| 350 void RenderWidgetResizeHelper::EventTimedWait( | 349 void RenderWidgetResizeHelper::EventTimedWait( |
| 351 base::WaitableEvent* event, base::TimeDelta delay) { | 350 base::WaitableEvent* event, base::TimeDelta delay) { |
| 352 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 351 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 353 event->TimedWait(delay); | 352 event->TimedWait(delay); |
| 354 } | 353 } |
| 355 | 354 |
| 356 } // namespace content | 355 } // namespace content |
| 357 | 356 |
| OLD | NEW |