Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: cc/trees/thread_proxy.cc

Issue 421183003: Revert of Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/debug/trace_event_argument.h"
14 #include "base/debug/trace_event_synthetic_delay.h" 13 #include "base/debug/trace_event_synthetic_delay.h"
15 #include "cc/base/swap_promise.h" 14 #include "cc/base/swap_promise.h"
16 #include "cc/debug/benchmark_instrumentation.h" 15 #include "cc/debug/benchmark_instrumentation.h"
17 #include "cc/debug/devtools_instrumentation.h" 16 #include "cc/debug/devtools_instrumentation.h"
18 #include "cc/input/input_handler.h" 17 #include "cc/input/input_handler.h"
19 #include "cc/output/context_provider.h" 18 #include "cc/output/context_provider.h"
20 #include "cc/output/output_surface.h" 19 #include "cc/output/output_surface.h"
21 #include "cc/quads/draw_quad.h" 20 #include "cc/quads/draw_quad.h"
22 #include "cc/resources/prioritized_resource_manager.h" 21 #include "cc/resources/prioritized_resource_manager.h"
23 #include "cc/scheduler/delay_based_time_source.h" 22 #include "cc/scheduler/delay_based_time_source.h"
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 return ResourceUpdateController::MaxPartialTextureUpdates(); 1288 return ResourceUpdateController::MaxPartialTextureUpdates();
1290 } 1289 }
1291 1290
1292 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() 1291 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState()
1293 : memory_allocation_limit_bytes(0), 1292 : memory_allocation_limit_bytes(0),
1294 memory_allocation_priority_cutoff(0), 1293 memory_allocation_priority_cutoff(0),
1295 evicted_ui_resources(false) {} 1294 evicted_ui_resources(false) {}
1296 1295
1297 ThreadProxy::BeginMainFrameAndCommitState::~BeginMainFrameAndCommitState() {} 1296 ThreadProxy::BeginMainFrameAndCommitState::~BeginMainFrameAndCommitState() {}
1298 1297
1299 void ThreadProxy::AsValueInto(base::debug::TracedValue* state) const { 1298 scoped_ptr<base::Value> ThreadProxy::AsValue() const {
1299 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1300
1300 CompletionEvent completion; 1301 CompletionEvent completion;
1301 { 1302 {
1302 DebugScopedSetMainThreadBlocked main_thread_blocked( 1303 DebugScopedSetMainThreadBlocked main_thread_blocked(
1303 const_cast<ThreadProxy*>(this)); 1304 const_cast<ThreadProxy*>(this));
1304 scoped_refptr<base::debug::TracedValue> state_refptr(state);
1305 Proxy::ImplThreadTaskRunner()->PostTask( 1305 Proxy::ImplThreadTaskRunner()->PostTask(
1306 FROM_HERE, 1306 FROM_HERE,
1307 base::Bind(&ThreadProxy::AsValueOnImplThread, 1307 base::Bind(&ThreadProxy::AsValueOnImplThread,
1308 impl_thread_weak_ptr_, 1308 impl_thread_weak_ptr_,
1309 &completion, 1309 &completion,
1310 state_refptr)); 1310 state.get()));
1311 completion.Wait(); 1311 completion.Wait();
1312 } 1312 }
1313 return state.PassAs<base::Value>();
1313 } 1314 }
1314 1315
1315 void ThreadProxy::AsValueOnImplThread(CompletionEvent* completion, 1316 void ThreadProxy::AsValueOnImplThread(CompletionEvent* completion,
1316 base::debug::TracedValue* state) const { 1317 base::DictionaryValue* state) const {
1317 state->BeginDictionary("layer_tree_host_impl"); 1318 state->Set("layer_tree_host_impl",
1318 impl().layer_tree_host_impl->AsValueInto(state); 1319 impl().layer_tree_host_impl->AsValue().release());
1319 state->EndDictionary();
1320 completion->Signal(); 1320 completion->Signal();
1321 } 1321 }
1322 1322
1323 bool ThreadProxy::CommitPendingForTesting() { 1323 bool ThreadProxy::CommitPendingForTesting() {
1324 DCHECK(IsMainThread()); 1324 DCHECK(IsMainThread());
1325 CommitPendingRequest commit_pending_request; 1325 CommitPendingRequest commit_pending_request;
1326 { 1326 {
1327 DebugScopedSetMainThreadBlocked main_thread_blocked(this); 1327 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
1328 Proxy::ImplThreadTaskRunner()->PostTask( 1328 Proxy::ImplThreadTaskRunner()->PostTask(
1329 FROM_HERE, 1329 FROM_HERE,
1330 base::Bind(&ThreadProxy::CommitPendingOnImplThreadForTesting, 1330 base::Bind(&ThreadProxy::CommitPendingOnImplThreadForTesting,
1331 impl_thread_weak_ptr_, 1331 impl_thread_weak_ptr_,
1332 &commit_pending_request)); 1332 &commit_pending_request));
1333 commit_pending_request.completion.Wait(); 1333 commit_pending_request.completion.Wait();
1334 } 1334 }
1335 return commit_pending_request.commit_pending; 1335 return commit_pending_request.commit_pending;
1336 } 1336 }
1337 1337
1338 void ThreadProxy::CommitPendingOnImplThreadForTesting( 1338 void ThreadProxy::CommitPendingOnImplThreadForTesting(
1339 CommitPendingRequest* request) { 1339 CommitPendingRequest* request) {
1340 DCHECK(IsImplThread()); 1340 DCHECK(IsImplThread());
1341 if (impl().layer_tree_host_impl->output_surface()) 1341 if (impl().layer_tree_host_impl->output_surface())
1342 request->commit_pending = impl().scheduler->CommitPending(); 1342 request->commit_pending = impl().scheduler->CommitPending();
1343 else 1343 else
1344 request->commit_pending = false; 1344 request->commit_pending = false;
1345 request->completion.Signal(); 1345 request->completion.Signal();
1346 } 1346 }
1347 1347
1348 scoped_ptr<base::Value> ThreadProxy::SchedulerAsValueForTesting() {
1349 if (IsImplThread())
1350 return impl().scheduler->AsValue().Pass();
1351
1352 SchedulerStateRequest scheduler_state_request;
1353 {
1354 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
1355 Proxy::ImplThreadTaskRunner()->PostTask(
1356 FROM_HERE,
1357 base::Bind(&ThreadProxy::SchedulerAsValueOnImplThreadForTesting,
1358 impl_thread_weak_ptr_,
1359 &scheduler_state_request));
1360 scheduler_state_request.completion.Wait();
1361 }
1362 return scheduler_state_request.state.Pass();
1363 }
1364
1365 void ThreadProxy::SchedulerAsValueOnImplThreadForTesting(
1366 SchedulerStateRequest* request) {
1367 DCHECK(IsImplThread());
1368 request->state = impl().scheduler->AsValue();
1369 request->completion.Signal();
1370 }
1371
1348 void ThreadProxy::RenewTreePriority() { 1372 void ThreadProxy::RenewTreePriority() {
1349 DCHECK(IsImplThread()); 1373 DCHECK(IsImplThread());
1350 bool smoothness_takes_priority = 1374 bool smoothness_takes_priority =
1351 impl().layer_tree_host_impl->pinch_gesture_active() || 1375 impl().layer_tree_host_impl->pinch_gesture_active() ||
1352 impl().layer_tree_host_impl->page_scale_animation_active() || 1376 impl().layer_tree_host_impl->page_scale_animation_active() ||
1353 (impl().layer_tree_host_impl->IsCurrentlyScrolling() && 1377 (impl().layer_tree_host_impl->IsCurrentlyScrolling() &&
1354 !impl().layer_tree_host_impl->scroll_affects_scroll_handler()); 1378 !impl().layer_tree_host_impl->scroll_affects_scroll_handler());
1355 1379
1356 // Schedule expiration if smoothness currently takes priority. 1380 // Schedule expiration if smoothness currently takes priority.
1357 if (smoothness_takes_priority) 1381 if (smoothness_takes_priority)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 1437
1414 impl().timing_history.DidActivateSyncTree(); 1438 impl().timing_history.DidActivateSyncTree();
1415 } 1439 }
1416 1440
1417 void ThreadProxy::DidManageTiles() { 1441 void ThreadProxy::DidManageTiles() {
1418 DCHECK(IsImplThread()); 1442 DCHECK(IsImplThread());
1419 impl().scheduler->DidManageTiles(); 1443 impl().scheduler->DidManageTiles();
1420 } 1444 }
1421 1445
1422 } // namespace cc 1446 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698