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

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

Issue 608503005: Revert of cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « cc/trees/single_thread_proxy.cc ('k') | cc/trees/tree_synchronizer.cc » ('j') | 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"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 struct ThreadProxy::SchedulerStateRequest { 43 struct ThreadProxy::SchedulerStateRequest {
44 CompletionEvent completion; 44 CompletionEvent completion;
45 scoped_ptr<base::Value> state; 45 scoped_ptr<base::Value> state;
46 }; 46 };
47 47
48 scoped_ptr<Proxy> ThreadProxy::Create( 48 scoped_ptr<Proxy> ThreadProxy::Create(
49 LayerTreeHost* layer_tree_host, 49 LayerTreeHost* layer_tree_host,
50 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 50 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
51 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 51 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
52 return make_scoped_ptr( 52 return make_scoped_ptr(new ThreadProxy(layer_tree_host,
53 new ThreadProxy(layer_tree_host, main_task_runner, impl_task_runner)); 53 main_task_runner,
54 impl_task_runner)).PassAs<Proxy>();
54 } 55 }
55 56
56 ThreadProxy::ThreadProxy( 57 ThreadProxy::ThreadProxy(
57 LayerTreeHost* layer_tree_host, 58 LayerTreeHost* layer_tree_host,
58 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 59 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
59 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) 60 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
60 : Proxy(main_task_runner, impl_task_runner), 61 : Proxy(main_task_runner, impl_task_runner),
61 main_thread_only_vars_unsafe_(this, layer_tree_host->id()), 62 main_thread_only_vars_unsafe_(this, layer_tree_host->id()),
62 main_thread_or_blocked_vars_unsafe_(layer_tree_host), 63 main_thread_or_blocked_vars_unsafe_(layer_tree_host),
63 compositor_thread_vars_unsafe_( 64 compositor_thread_vars_unsafe_(
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 956
956 void ThreadProxy::ScheduledActionCommit() { 957 void ThreadProxy::ScheduledActionCommit() {
957 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); 958 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit");
958 DCHECK(IsImplThread()); 959 DCHECK(IsImplThread());
959 DCHECK(IsMainThreadBlocked()); 960 DCHECK(IsMainThreadBlocked());
960 DCHECK(impl().commit_completion_event); 961 DCHECK(impl().commit_completion_event);
961 DCHECK(impl().current_resource_update_controller); 962 DCHECK(impl().current_resource_update_controller);
962 963
963 // Complete all remaining texture updates. 964 // Complete all remaining texture updates.
964 impl().current_resource_update_controller->Finalize(); 965 impl().current_resource_update_controller->Finalize();
965 impl().current_resource_update_controller = nullptr; 966 impl().current_resource_update_controller.reset();
966 967
967 if (impl().animations_frozen_until_next_draw) { 968 if (impl().animations_frozen_until_next_draw) {
968 impl().animation_time = std::max( 969 impl().animation_time = std::max(
969 impl().animation_time, blocked_main().last_monotonic_frame_begin_time); 970 impl().animation_time, blocked_main().last_monotonic_frame_begin_time);
970 } 971 }
971 impl().did_commit_after_animating = true; 972 impl().did_commit_after_animating = true;
972 973
973 blocked_main().main_thread_inside_commit = true; 974 blocked_main().main_thread_inside_commit = true;
974 impl().layer_tree_host_impl->BeginCommit(); 975 impl().layer_tree_host_impl->BeginCommit();
975 layer_tree_host()->BeginCommitOnImplThread(impl().layer_tree_host_impl.get()); 976 layer_tree_host()->BeginCommitOnImplThread(impl().layer_tree_host_impl.get());
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1242 }
1242 completion->Signal(); 1243 completion->Signal();
1243 } 1244 }
1244 1245
1245 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { 1246 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
1246 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); 1247 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread");
1247 DCHECK(IsImplThread()); 1248 DCHECK(IsImplThread());
1248 DCHECK(IsMainThreadBlocked()); 1249 DCHECK(IsMainThreadBlocked());
1249 layer_tree_host()->DeleteContentsTexturesOnImplThread( 1250 layer_tree_host()->DeleteContentsTexturesOnImplThread(
1250 impl().layer_tree_host_impl->resource_provider()); 1251 impl().layer_tree_host_impl->resource_provider());
1251 impl().current_resource_update_controller = nullptr; 1252 impl().current_resource_update_controller.reset();
1252 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); 1253 impl().layer_tree_host_impl->SetNeedsBeginFrame(false);
1253 impl().scheduler = nullptr; 1254 impl().scheduler.reset();
1254 impl().layer_tree_host_impl = nullptr; 1255 impl().layer_tree_host_impl.reset();
1255 impl().weak_factory.InvalidateWeakPtrs(); 1256 impl().weak_factory.InvalidateWeakPtrs();
1256 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. 1257 // We need to explicitly cancel the notifier, since it isn't using weak ptrs.
1257 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep 1258 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep
1258 // the convention of having a weak ptr factory initialized last. Alternatively 1259 // the convention of having a weak ptr factory initialized last. Alternatively
1259 // we should moved the notifier (and RenewTreePriority) to LTHI. See 1260 // we should moved the notifier (and RenewTreePriority) to LTHI. See
1260 // crbug.com/411972 1261 // crbug.com/411972
1261 impl().smoothness_priority_expiration_notifier.Cancel(); 1262 impl().smoothness_priority_expiration_notifier.Cancel();
1262 impl().contents_texture_manager = NULL; 1263 impl().contents_texture_manager = NULL;
1263 completion->Signal(); 1264 completion->Signal();
1264 } 1265 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 1401
1401 impl().timing_history.DidActivateSyncTree(); 1402 impl().timing_history.DidActivateSyncTree();
1402 } 1403 }
1403 1404
1404 void ThreadProxy::DidManageTiles() { 1405 void ThreadProxy::DidManageTiles() {
1405 DCHECK(IsImplThread()); 1406 DCHECK(IsImplThread());
1406 impl().scheduler->DidManageTiles(); 1407 impl().scheduler->DidManageTiles();
1407 } 1408 }
1408 1409
1409 } // namespace cc 1410 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.cc ('k') | cc/trees/tree_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698