OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 UI_ACCELERATED_WIDGET_MAC_WINDOW_RESIZE_HELPER_MAC_H_ | 5 #ifndef UI_ACCELERATED_WIDGET_MAC_WINDOW_RESIZE_HELPER_MAC_H_ |
6 #define UI_ACCELERATED_WIDGET_MAC_WINDOW_RESIZE_HELPER_MAC_H_ | 6 #define UI_ACCELERATED_WIDGET_MAC_WINDOW_RESIZE_HELPER_MAC_H_ |
7 | 7 |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const; | 60 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const; |
61 | 61 |
62 // UI THREAD ONLY ----------------------------------------------------------- | 62 // UI THREAD ONLY ----------------------------------------------------------- |
63 | 63 |
64 // Waits at most |max_delay| for a task to run. Returns true if a task ran, | 64 // Waits at most |max_delay| for a task to run. Returns true if a task ran, |
65 // false if no task ran. | 65 // false if no task ran. |
66 bool WaitForSingleTaskToRun(const base::TimeDelta& max_delay); | 66 bool WaitForSingleTaskToRun(const base::TimeDelta& max_delay); |
67 | 67 |
68 private: | 68 private: |
69 friend struct base::DefaultLazyInstanceTraits<WindowResizeHelperMac>; | 69 friend struct base::LazyInstanceTraitsBase<WindowResizeHelperMac>; |
70 WindowResizeHelperMac(); | 70 WindowResizeHelperMac(); |
71 ~WindowResizeHelperMac(); | 71 ~WindowResizeHelperMac(); |
72 | 72 |
73 // This helper is needed to create a ScopedAllowWait inside the scope of a | 73 // This helper is needed to create a ScopedAllowWait inside the scope of a |
74 // class where it is allowed. | 74 // class where it is allowed. |
75 static void EventTimedWait(base::WaitableEvent* event, base::TimeDelta delay); | 75 static void EventTimedWait(base::WaitableEvent* event, base::TimeDelta delay); |
76 | 76 |
77 // The task runner to which the helper will post tasks. This also maintains | 77 // The task runner to which the helper will post tasks. This also maintains |
78 // the task queue and does the actual work for WaitForSingleTaskToRun. | 78 // the task queue and does the actual work for WaitForSingleTaskToRun. |
79 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 79 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(WindowResizeHelperMac); | 81 DISALLOW_COPY_AND_ASSIGN(WindowResizeHelperMac); |
82 }; | 82 }; |
83 | 83 |
84 } // namespace ui | 84 } // namespace ui |
85 | 85 |
86 #endif // UI_ACCELERATED_WIDGET_MAC_WINDOW_RESIZE_HELPER_MAC_H_ | 86 #endif // UI_ACCELERATED_WIDGET_MAC_WINDOW_RESIZE_HELPER_MAC_H_ |
OLD | NEW |