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 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 return ResourceUpdateController::MaxPartialTextureUpdates(); | 1245 return ResourceUpdateController::MaxPartialTextureUpdates(); |
1246 } | 1246 } |
1247 | 1247 |
1248 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() | 1248 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() |
1249 : memory_allocation_limit_bytes(0), | 1249 : memory_allocation_limit_bytes(0), |
1250 memory_allocation_priority_cutoff(0), | 1250 memory_allocation_priority_cutoff(0), |
1251 evicted_ui_resources(false) {} | 1251 evicted_ui_resources(false) {} |
1252 | 1252 |
1253 ThreadProxy::BeginMainFrameAndCommitState::~BeginMainFrameAndCommitState() {} | 1253 ThreadProxy::BeginMainFrameAndCommitState::~BeginMainFrameAndCommitState() {} |
1254 | 1254 |
1255 void ThreadProxy::AsValueInto(base::trace_event::TracedValue* state) const { | |
1256 CompletionEvent completion; | |
1257 { | |
1258 DebugScopedSetMainThreadBlocked main_thread_blocked( | |
1259 const_cast<ThreadProxy*>(this)); | |
1260 scoped_refptr<base::trace_event::TracedValue> state_refptr(state); | |
1261 Proxy::ImplThreadTaskRunner()->PostTask( | |
1262 FROM_HERE, | |
1263 base::Bind(&ThreadProxy::AsValueOnImplThread, | |
1264 impl_thread_weak_ptr_, | |
1265 &completion, | |
1266 state_refptr)); | |
1267 completion.Wait(); | |
1268 } | |
1269 } | |
1270 | |
1271 void ThreadProxy::AsValueOnImplThread( | |
1272 CompletionEvent* completion, | |
1273 base::trace_event::TracedValue* state) const { | |
1274 state->BeginDictionary("layer_tree_host_impl"); | |
1275 impl().layer_tree_host_impl->AsValueInto(state); | |
1276 state->EndDictionary(); | |
1277 completion->Signal(); | |
1278 } | |
1279 | |
1280 bool ThreadProxy::MainFrameWillHappenForTesting() { | 1255 bool ThreadProxy::MainFrameWillHappenForTesting() { |
1281 DCHECK(IsMainThread()); | 1256 DCHECK(IsMainThread()); |
1282 CompletionEvent completion; | 1257 CompletionEvent completion; |
1283 bool main_frame_will_happen = false; | 1258 bool main_frame_will_happen = false; |
1284 { | 1259 { |
1285 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 1260 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
1286 Proxy::ImplThreadTaskRunner()->PostTask( | 1261 Proxy::ImplThreadTaskRunner()->PostTask( |
1287 FROM_HERE, | 1262 FROM_HERE, |
1288 base::Bind(&ThreadProxy::MainFrameWillHappenOnImplThreadForTesting, | 1263 base::Bind(&ThreadProxy::MainFrameWillHappenOnImplThreadForTesting, |
1289 impl_thread_weak_ptr_, | 1264 impl_thread_weak_ptr_, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 } | 1363 } |
1389 | 1364 |
1390 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { | 1365 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { |
1391 DCHECK(IsImplThread()); | 1366 DCHECK(IsImplThread()); |
1392 Proxy::MainThreadTaskRunner()->PostTask( | 1367 Proxy::MainThreadTaskRunner()->PostTask( |
1393 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, | 1368 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, |
1394 main_thread_weak_ptr_)); | 1369 main_thread_weak_ptr_)); |
1395 } | 1370 } |
1396 | 1371 |
1397 } // namespace cc | 1372 } // namespace cc |
OLD | NEW |