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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 ~RenderWidgetResizeHelper(); | 75 ~RenderWidgetResizeHelper(); |
76 | 76 |
77 // A classed used to wrap an IPC or a task. | 77 // A classed used to wrap an IPC or a task. |
78 class EnqueuedTask; | 78 class EnqueuedTask; |
79 friend class EnqueuedTask; | 79 friend class EnqueuedTask; |
80 | 80 |
81 // Called on the IO thread to add a task to the queue. | 81 // Called on the IO thread to add a task to the queue. |
82 void PostEnqueuedTask(EnqueuedTask* proxy); | 82 void PostEnqueuedTask(EnqueuedTask* proxy); |
83 | 83 |
84 // Called on the UI to remove the task from the queue when it is run. | 84 // Called on the UI to remove the task from the queue when it is run. |
85 void WillRunEnqueuedTask(EnqueuedTask* proxy); | 85 void RemoveEnqueuedTaskFromQueue(EnqueuedTask* proxy); |
86 | 86 |
87 // A queue of live messages. Must hold |task_queue_lock_| to access. | 87 // A queue of live messages. Must hold |task_queue_lock_| to access. Tasks |
88 // The EnqueuedTask objects are removed from the front of the queue when | 88 // are added only on the IO thread and removed only on the UI thread. The |
89 // they are run (either by TaskRunner they were posted to or by a call to | 89 // EnqueuedTask objects are removed from the front of the queue when they are |
90 // WaitForSingleTaskToRun pulling them off of the queue). | 90 // run (by TaskRunner they were posted to, by a call to WaitForSingleTaskToRun |
| 91 // pulling them off of the queue, or by TaskRunner when it is destroyed). |
91 typedef std::deque<EnqueuedTask*> EnqueuedTaskQueue; | 92 typedef std::deque<EnqueuedTask*> EnqueuedTaskQueue; |
92 EnqueuedTaskQueue task_queue_; | 93 EnqueuedTaskQueue task_queue_; |
93 base::Lock task_queue_lock_; | 94 base::Lock task_queue_lock_; |
94 | 95 |
95 // Event used to wake up the UI thread if it is sleeping in | 96 // Event used to wake up the UI thread if it is sleeping in |
96 // WaitForSingleTaskToRun. | 97 // WaitForSingleTaskToRun. |
97 base::WaitableEvent event_; | 98 base::WaitableEvent event_; |
98 }; | 99 }; |
99 | 100 |
100 } // namespace content | 101 } // namespace content |
101 | 102 |
102 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_H_ | 103 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_H_ |
OLD | NEW |