| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, | 73 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, |
| 74 int layer_tree_host_id) | 74 int layer_tree_host_id) |
| 75 : layer_tree_host_id(layer_tree_host_id), | 75 : layer_tree_host_id(layer_tree_host_id), |
| 76 animate_requested(false), | 76 animate_requested(false), |
| 77 commit_requested(false), | 77 commit_requested(false), |
| 78 commit_request_sent_to_impl_thread(false), | 78 commit_request_sent_to_impl_thread(false), |
| 79 started(false), | 79 started(false), |
| 80 manage_tiles_pending(false), | 80 manage_tiles_pending(false), |
| 81 can_cancel_commit(true), | 81 can_cancel_commit(true), |
| 82 defer_commits(false), | 82 defer_commits(false), |
| 83 weak_factory(proxy) {} | 83 host_client_finished_(false), |
| 84 weak_factory(proxy) { |
| 85 } |
| 84 | 86 |
| 85 ThreadProxy::MainThreadOnly::~MainThreadOnly() {} | 87 ThreadProxy::MainThreadOnly::~MainThreadOnly() {} |
| 86 | 88 |
| 87 ThreadProxy::MainThreadOrBlockedMainThread::MainThreadOrBlockedMainThread( | 89 ThreadProxy::MainThreadOrBlockedMainThread::MainThreadOrBlockedMainThread( |
| 88 LayerTreeHost* host) | 90 LayerTreeHost* host) |
| 89 : layer_tree_host(host), | 91 : layer_tree_host(host), |
| 90 commit_waits_for_activation(false), | 92 commit_waits_for_activation(false), |
| 91 main_thread_inside_commit(false) {} | 93 main_thread_inside_commit(false) {} |
| 92 | 94 |
| 93 ThreadProxy::MainThreadOrBlockedMainThread::~MainThreadOrBlockedMainThread() {} | 95 ThreadProxy::MainThreadOrBlockedMainThread::~MainThreadOrBlockedMainThread() {} |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 150 } |
| 149 | 151 |
| 150 void ThreadProxy::SetLayerTreeHostClientReady() { | 152 void ThreadProxy::SetLayerTreeHostClientReady() { |
| 151 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReady"); | 153 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReady"); |
| 152 Proxy::ImplThreadTaskRunner()->PostTask( | 154 Proxy::ImplThreadTaskRunner()->PostTask( |
| 153 FROM_HERE, | 155 FROM_HERE, |
| 154 base::Bind(&ThreadProxy::SetLayerTreeHostClientReadyOnImplThread, | 156 base::Bind(&ThreadProxy::SetLayerTreeHostClientReadyOnImplThread, |
| 155 impl_thread_weak_ptr_)); | 157 impl_thread_weak_ptr_)); |
| 156 } | 158 } |
| 157 | 159 |
| 160 void ThreadProxy::SetLayerTreeHostClientFinished() { |
| 161 main().host_client_finished_ = true; |
| 162 } |
| 163 |
| 158 void ThreadProxy::SetLayerTreeHostClientReadyOnImplThread() { | 164 void ThreadProxy::SetLayerTreeHostClientReadyOnImplThread() { |
| 159 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReadyOnImplThread"); | 165 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReadyOnImplThread"); |
| 160 impl().scheduler->SetCanStart(); | 166 impl().scheduler->SetCanStart(); |
| 161 } | 167 } |
| 162 | 168 |
| 163 void ThreadProxy::SetVisible(bool visible) { | 169 void ThreadProxy::SetVisible(bool visible) { |
| 164 TRACE_EVENT0("cc", "ThreadProxy::SetVisible"); | 170 TRACE_EVENT0("cc", "ThreadProxy::SetVisible"); |
| 165 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 171 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 166 | 172 |
| 167 CompletionEvent completion; | 173 CompletionEvent completion; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 impl_thread_weak_ptr_, | 217 impl_thread_weak_ptr_, |
| 212 &completion)); | 218 &completion)); |
| 213 completion.Wait(); | 219 completion.Wait(); |
| 214 } | 220 } |
| 215 } | 221 } |
| 216 | 222 |
| 217 void ThreadProxy::CreateAndInitializeOutputSurface() { | 223 void ThreadProxy::CreateAndInitializeOutputSurface() { |
| 218 TRACE_EVENT0("cc", "ThreadProxy::DoCreateAndInitializeOutputSurface"); | 224 TRACE_EVENT0("cc", "ThreadProxy::DoCreateAndInitializeOutputSurface"); |
| 219 DCHECK(IsMainThread()); | 225 DCHECK(IsMainThread()); |
| 220 | 226 |
| 227 if (main().host_client_finished_) |
| 228 return; |
| 229 |
| 221 scoped_ptr<OutputSurface> output_surface = | 230 scoped_ptr<OutputSurface> output_surface = |
| 222 layer_tree_host()->CreateOutputSurface(); | 231 layer_tree_host()->CreateOutputSurface(); |
| 223 | 232 |
| 224 if (output_surface) { | 233 if (output_surface) { |
| 225 Proxy::ImplThreadTaskRunner()->PostTask( | 234 Proxy::ImplThreadTaskRunner()->PostTask( |
| 226 FROM_HERE, | 235 FROM_HERE, |
| 227 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, | 236 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, |
| 228 impl_thread_weak_ptr_, | 237 impl_thread_weak_ptr_, |
| 229 base::Passed(&output_surface))); | 238 base::Passed(&output_surface))); |
| 230 return; | 239 return; |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 | 1399 |
| 1391 impl().timing_history.DidActivateSyncTree(); | 1400 impl().timing_history.DidActivateSyncTree(); |
| 1392 } | 1401 } |
| 1393 | 1402 |
| 1394 void ThreadProxy::DidManageTiles() { | 1403 void ThreadProxy::DidManageTiles() { |
| 1395 DCHECK(IsImplThread()); | 1404 DCHECK(IsImplThread()); |
| 1396 impl().scheduler->DidManageTiles(); | 1405 impl().scheduler->DidManageTiles(); |
| 1397 } | 1406 } |
| 1398 | 1407 |
| 1399 } // namespace cc | 1408 } // namespace cc |
| OLD | NEW |