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

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

Issue 640203002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr [part-… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format fix. Created 6 years, 2 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
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"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 PrioritizedResourceManager* 94 PrioritizedResourceManager*
95 ThreadProxy::MainThreadOrBlockedMainThread::contents_texture_manager() { 95 ThreadProxy::MainThreadOrBlockedMainThread::contents_texture_manager() {
96 return layer_tree_host->contents_texture_manager(); 96 return layer_tree_host->contents_texture_manager();
97 } 97 }
98 98
99 ThreadProxy::CompositorThreadOnly::CompositorThreadOnly( 99 ThreadProxy::CompositorThreadOnly::CompositorThreadOnly(
100 ThreadProxy* proxy, 100 ThreadProxy* proxy,
101 int layer_tree_host_id, 101 int layer_tree_host_id,
102 RenderingStatsInstrumentation* rendering_stats_instrumentation) 102 RenderingStatsInstrumentation* rendering_stats_instrumentation)
103 : layer_tree_host_id(layer_tree_host_id), 103 : layer_tree_host_id(layer_tree_host_id),
104 contents_texture_manager(NULL), 104 contents_texture_manager(nullptr),
105 commit_completion_event(NULL), 105 commit_completion_event(nullptr),
106 completion_event_for_commit_held_on_tree_activation(NULL), 106 completion_event_for_commit_held_on_tree_activation(nullptr),
107 next_frame_is_newly_committed_frame(false), 107 next_frame_is_newly_committed_frame(false),
108 inside_draw(false), 108 inside_draw(false),
109 input_throttled_until_commit(false), 109 input_throttled_until_commit(false),
110 animations_frozen_until_next_draw(false), 110 animations_frozen_until_next_draw(false),
111 smoothness_priority_expiration_notifier( 111 smoothness_priority_expiration_notifier(
112 proxy->ImplThreadTaskRunner(), 112 proxy->ImplThreadTaskRunner(),
113 base::Bind(&ThreadProxy::RenewTreePriority, base::Unretained(proxy)), 113 base::Bind(&ThreadProxy::RenewTreePriority, base::Unretained(proxy)),
114 base::TimeDelta::FromMilliseconds( 114 base::TimeDelta::FromMilliseconds(
115 kSmoothnessTakesPriorityExpirationDelay * 1000)), 115 kSmoothnessTakesPriorityExpirationDelay * 1000)),
116 timing_history(rendering_stats_instrumentation), 116 timing_history(rendering_stats_instrumentation),
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 CompletionEvent completion; 614 CompletionEvent completion;
615 Proxy::ImplThreadTaskRunner()->PostTask( 615 Proxy::ImplThreadTaskRunner()->PostTask(
616 FROM_HERE, 616 FROM_HERE,
617 base::Bind(&ThreadProxy::LayerTreeHostClosedOnImplThread, 617 base::Bind(&ThreadProxy::LayerTreeHostClosedOnImplThread,
618 impl_thread_weak_ptr_, 618 impl_thread_weak_ptr_,
619 &completion)); 619 &completion));
620 completion.Wait(); 620 completion.Wait();
621 } 621 }
622 622
623 main().weak_factory.InvalidateWeakPtrs(); 623 main().weak_factory.InvalidateWeakPtrs();
624 blocked_main().layer_tree_host = NULL; 624 blocked_main().layer_tree_host = nullptr;
625 main().started = false; 625 main().started = false;
626 } 626 }
627 627
628 void ThreadProxy::ForceSerializeOnSwapBuffers() { 628 void ThreadProxy::ForceSerializeOnSwapBuffers() {
629 DebugScopedSetMainThreadBlocked main_thread_blocked(this); 629 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
630 CompletionEvent completion; 630 CompletionEvent completion;
631 Proxy::ImplThreadTaskRunner()->PostTask( 631 Proxy::ImplThreadTaskRunner()->PostTask(
632 FROM_HERE, 632 FROM_HERE,
633 base::Bind(&ThreadProxy::ForceSerializeOnSwapBuffersOnImplThread, 633 base::Bind(&ThreadProxy::ForceSerializeOnSwapBuffersOnImplThread,
634 impl_thread_weak_ptr_, 634 impl_thread_weak_ptr_,
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 blocked_main().commit_waits_for_activation; 972 blocked_main().commit_waits_for_activation;
973 blocked_main().commit_waits_for_activation = false; 973 blocked_main().commit_waits_for_activation = false;
974 974
975 if (hold_commit) { 975 if (hold_commit) {
976 // For some layer types in impl-side painting, the commit is held until 976 // For some layer types in impl-side painting, the commit is held until
977 // the sync tree is activated. It's also possible that the 977 // the sync tree is activated. It's also possible that the
978 // sync tree has already activated if there was no work to be done. 978 // sync tree has already activated if there was no work to be done.
979 TRACE_EVENT_INSTANT0("cc", "HoldCommit", TRACE_EVENT_SCOPE_THREAD); 979 TRACE_EVENT_INSTANT0("cc", "HoldCommit", TRACE_EVENT_SCOPE_THREAD);
980 impl().completion_event_for_commit_held_on_tree_activation = 980 impl().completion_event_for_commit_held_on_tree_activation =
981 impl().commit_completion_event; 981 impl().commit_completion_event;
982 impl().commit_completion_event = NULL; 982 impl().commit_completion_event = nullptr;
983 } else { 983 } else {
984 impl().commit_completion_event->Signal(); 984 impl().commit_completion_event->Signal();
985 impl().commit_completion_event = NULL; 985 impl().commit_completion_event = nullptr;
986 } 986 }
987 987
988 // Delay this step until afer the main thread has been released as it's 988 // Delay this step until afer the main thread has been released as it's
989 // often a good bit of work to update the tree and prepare the new frame. 989 // often a good bit of work to update the tree and prepare the new frame.
990 impl().layer_tree_host_impl->CommitComplete(); 990 impl().layer_tree_host_impl->CommitComplete();
991 991
992 SetInputThrottledUntilCommitOnImplThread(false); 992 SetInputThrottledUntilCommitOnImplThread(false);
993 993
994 UpdateBackgroundAnimateTicking(); 994 UpdateBackgroundAnimateTicking();
995 995
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 impl().layer_tree_host_impl->SetNeedsBeginFrames(false); 1238 impl().layer_tree_host_impl->SetNeedsBeginFrames(false);
1239 impl().scheduler = nullptr; 1239 impl().scheduler = nullptr;
1240 impl().layer_tree_host_impl = nullptr; 1240 impl().layer_tree_host_impl = nullptr;
1241 impl().weak_factory.InvalidateWeakPtrs(); 1241 impl().weak_factory.InvalidateWeakPtrs();
1242 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. 1242 // We need to explicitly cancel the notifier, since it isn't using weak ptrs.
1243 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep 1243 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep
1244 // the convention of having a weak ptr factory initialized last. Alternatively 1244 // the convention of having a weak ptr factory initialized last. Alternatively
1245 // we should moved the notifier (and RenewTreePriority) to LTHI. See 1245 // we should moved the notifier (and RenewTreePriority) to LTHI. See
1246 // crbug.com/411972 1246 // crbug.com/411972
1247 impl().smoothness_priority_expiration_notifier.Cancel(); 1247 impl().smoothness_priority_expiration_notifier.Cancel();
1248 impl().contents_texture_manager = NULL; 1248 impl().contents_texture_manager = nullptr;
1249 completion->Signal(); 1249 completion->Signal();
1250 } 1250 }
1251 1251
1252 size_t ThreadProxy::MaxPartialTextureUpdates() const { 1252 size_t ThreadProxy::MaxPartialTextureUpdates() const {
1253 return ResourceUpdateController::MaxPartialTextureUpdates(); 1253 return ResourceUpdateController::MaxPartialTextureUpdates();
1254 } 1254 }
1255 1255
1256 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() 1256 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState()
1257 : memory_allocation_limit_bytes(0), 1257 : memory_allocation_limit_bytes(0),
1258 memory_allocation_priority_cutoff(0), 1258 memory_allocation_priority_cutoff(0),
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 1372
1373 void ThreadProxy::DidActivateSyncTree() { 1373 void ThreadProxy::DidActivateSyncTree() {
1374 TRACE_EVENT0("cc", "ThreadProxy::DidActivateSyncTreeOnImplThread"); 1374 TRACE_EVENT0("cc", "ThreadProxy::DidActivateSyncTreeOnImplThread");
1375 DCHECK(IsImplThread()); 1375 DCHECK(IsImplThread());
1376 1376
1377 if (impl().completion_event_for_commit_held_on_tree_activation) { 1377 if (impl().completion_event_for_commit_held_on_tree_activation) {
1378 TRACE_EVENT_INSTANT0( 1378 TRACE_EVENT_INSTANT0(
1379 "cc", "ReleaseCommitbyActivation", TRACE_EVENT_SCOPE_THREAD); 1379 "cc", "ReleaseCommitbyActivation", TRACE_EVENT_SCOPE_THREAD);
1380 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); 1380 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting);
1381 impl().completion_event_for_commit_held_on_tree_activation->Signal(); 1381 impl().completion_event_for_commit_held_on_tree_activation->Signal();
1382 impl().completion_event_for_commit_held_on_tree_activation = NULL; 1382 impl().completion_event_for_commit_held_on_tree_activation = nullptr;
1383 } 1383 }
1384 1384
1385 UpdateBackgroundAnimateTicking(); 1385 UpdateBackgroundAnimateTicking();
1386 1386
1387 impl().timing_history.DidActivateSyncTree(); 1387 impl().timing_history.DidActivateSyncTree();
1388 } 1388 }
1389 1389
1390 void ThreadProxy::DidManageTiles() { 1390 void ThreadProxy::DidManageTiles() {
1391 DCHECK(IsImplThread()); 1391 DCHECK(IsImplThread());
1392 impl().scheduler->DidManageTiles(); 1392 impl().scheduler->DidManageTiles();
1393 } 1393 }
1394 1394
1395 } // namespace cc 1395 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698