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 CC_TREES_THREADED_CHANNEL_H_ | 5 #ifndef CC_TREES_THREADED_CHANNEL_H_ |
6 #define CC_TREES_THREADED_CHANNEL_H_ | 6 #define CC_TREES_THREADED_CHANNEL_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // sequence. Currently ThreadProxy implements both so we pass the pointer | 69 // sequence. Currently ThreadProxy implements both so we pass the pointer |
70 // and set ProxyImpl. | 70 // and set ProxyImpl. |
71 ThreadProxy* thread_proxy, | 71 ThreadProxy* thread_proxy, |
72 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 72 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
73 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 73 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
74 | 74 |
75 ~ThreadedChannel() override; | 75 ~ThreadedChannel() override; |
76 | 76 |
77 // ChannelMain Implementation | 77 // ChannelMain Implementation |
78 void SetThrottleFrameProductionOnImpl(bool throttle) override; | 78 void SetThrottleFrameProductionOnImpl(bool throttle) override; |
| 79 void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface) override; |
| 80 void MainThreadHasStoppedFlingingOnImpl() override; |
| 81 void SetInputThrottledUntilCommitOnImpl(bool is_throttled) override; |
| 82 void SetDeferCommitsOnImpl(bool defer_commits) override; |
| 83 |
| 84 // Blocking calls to ProxyImpl |
| 85 void FinishAllRenderingOnImpl() override; |
| 86 void SetVisibleOnImpl(bool visible) override; |
| 87 void ReleaseOutputSurfaceOnImpl() override; |
| 88 void FinishGLOnImpl() override; |
| 89 void MainFrameWillHappenOnImplForTesting( |
| 90 bool* main_frame_will_happen) override; |
79 | 91 |
80 // ChannelImpl Implementation | 92 // ChannelImpl Implementation |
81 void DidCompleteSwapBuffers() override; | 93 void DidCompleteSwapBuffers() override; |
| 94 void SetRendererCapabilitiesMainCopy( |
| 95 const RendererCapabilities& capabilities) override; |
| 96 void BeginMainFrameNotExpectedSoon() override; |
| 97 void DidCommitAndDrawFrame() override; |
| 98 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue) override; |
| 99 void DidLoseOutputSurface() override; |
| 100 void RequestNewOutputSurface() override; |
| 101 void DidInitializeOutputSurface( |
| 102 bool success, |
| 103 const RendererCapabilities& capabilities) override; |
| 104 void DidCompletePageScaleAnimation() override; |
| 105 void PostFrameTimingEventsOnMain( |
| 106 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
| 107 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) |
| 108 override; |
| 109 |
| 110 // TODO(khushalsagar): Remove this. Temporary method to create the weak |
| 111 // pointer on the impl thread |
| 112 void InitImplThreadWeakPtr(); |
| 113 void InvalidateImplThreadWeakPtr(); |
82 | 114 |
83 protected: | 115 protected: |
84 ThreadedChannel(ThreadProxy* thread_proxy, | 116 ThreadedChannel(ThreadProxy* thread_proxy, |
85 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 117 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
86 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 118 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
87 | 119 |
88 private: | 120 private: |
89 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; | 121 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; |
90 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; | 122 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; |
91 | 123 |
| 124 void BlockingFinishAllRenderingOnImpl(CompletionEvent* completion); |
| 125 void BlockingSetVisibleOnImpl(CompletionEvent* completion, bool visible); |
| 126 void BlockingReleaseOutputSurfaceOnImpl(CompletionEvent* completion); |
| 127 void BlockingFinishGLOnImpl(CompletionEvent* completion); |
| 128 void BlockingMainFrameWillHappenOnImplForTesting( |
| 129 CompletionEvent* completion, |
| 130 bool* main_frame_will_happen); |
| 131 |
92 ProxyMain* proxy_main_; | 132 ProxyMain* proxy_main_; |
93 | 133 |
94 ProxyImpl* proxy_impl_; | 134 ProxyImpl* proxy_impl_; |
95 | 135 |
96 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 136 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
97 | 137 |
98 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 138 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
99 | 139 |
| 140 // TODO(khushalsagar): Initialize this in ThreadedChannel when ChannelImpl |
| 141 // gets initialization call. |
| 142 base::WeakPtr<ThreadedChannel> impl_thread_weak_ptr_; |
| 143 |
| 144 base::WeakPtrFactory<ThreadedChannel> impl_weak_factory_; |
| 145 |
100 DISALLOW_COPY_AND_ASSIGN(ThreadedChannel); | 146 DISALLOW_COPY_AND_ASSIGN(ThreadedChannel); |
101 }; | 147 }; |
102 | 148 |
103 } // namespace cc | 149 } // namespace cc |
104 | 150 |
105 #endif // CC_TREES_THREADED_CHANNEL_H_ | 151 #endif // CC_TREES_THREADED_CHANNEL_H_ |
OLD | NEW |