Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/proxy_impl.h" | 5 #include "cc/trees/proxy_impl.h" |
| 6 | 6 |
| 7 #include <string.h> | |
| 8 | |
| 7 #include <algorithm> | 9 #include <algorithm> |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 10 #include "base/auto_reset.h" | 12 #include "base/auto_reset.h" |
| 13 #include "base/debug/alias.h" | |
| 14 #include "base/debug/dump_without_crashing.h" | |
| 11 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 12 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 13 #include "base/trace_event/trace_event_argument.h" | 17 #include "base/trace_event/trace_event_argument.h" |
| 14 #include "base/trace_event/trace_event_synthetic_delay.h" | 18 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 15 #include "cc/base/devtools_instrumentation.h" | 19 #include "cc/base/devtools_instrumentation.h" |
| 16 #include "cc/benchmarks/benchmark_instrumentation.h" | 20 #include "cc/benchmarks/benchmark_instrumentation.h" |
| 17 #include "cc/input/browser_controls_offset_manager.h" | 21 #include "cc/input/browser_controls_offset_manager.h" |
| 18 #include "cc/output/compositor_frame_sink.h" | 22 #include "cc/output/compositor_frame_sink.h" |
| 19 #include "cc/output/context_provider.h" | 23 #include "cc/output/context_provider.h" |
| 20 #include "cc/scheduler/compositor_timing_history.h" | 24 #include "cc/scheduler/compositor_timing_history.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 bool* main_frame_will_happen) { | 220 bool* main_frame_will_happen) { |
| 217 DCHECK(IsImplThread()); | 221 DCHECK(IsImplThread()); |
| 218 if (layer_tree_host_impl_->compositor_frame_sink()) { | 222 if (layer_tree_host_impl_->compositor_frame_sink()) { |
| 219 *main_frame_will_happen = scheduler_->MainFrameForTestingWillHappen(); | 223 *main_frame_will_happen = scheduler_->MainFrameForTestingWillHappen(); |
| 220 } else { | 224 } else { |
| 221 *main_frame_will_happen = false; | 225 *main_frame_will_happen = false; |
| 222 } | 226 } |
| 223 completion->Signal(); | 227 completion->Signal(); |
| 224 } | 228 } |
| 225 | 229 |
| 230 // TODO(sunnyps): Remove this code once crbug.com/668892 is fixed. | |
| 231 NOINLINE void ProxyImpl::DumpForBeginMainFrameHang() { | |
| 232 DCHECK(IsImplThread()); | |
| 233 DCHECK(scheduler_); | |
| 234 | |
| 235 char stack_string[20000] = "\0"; | |
|
vmpstr
2017/04/11 01:06:46
nit: = ""; (or = {}; or = {0};)
sunnyps
2017/04/11 18:22:48
Done.
| |
| 236 base::debug::Alias(&stack_string); | |
| 237 | |
| 238 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> scheduler_state = | |
| 239 scheduler_->AsValue(); | |
| 240 strncat(stack_string, scheduler_state->ToString().c_str(), | |
| 241 arraysize(stack_string) - strlen(stack_string) - 1); | |
| 242 | |
| 243 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | |
| 244 tile_manager_state = | |
| 245 layer_tree_host_impl_->tile_manager()->ActivationStateAsValue(); | |
| 246 strncat(stack_string, tile_manager_state->ToString().c_str(), | |
| 247 arraysize(stack_string) - strlen(stack_string) - 1); | |
| 248 | |
| 249 base::debug::DumpWithoutCrashing(); | |
| 250 } | |
| 251 | |
| 226 void ProxyImpl::NotifyReadyToCommitOnImpl( | 252 void ProxyImpl::NotifyReadyToCommitOnImpl( |
| 227 CompletionEvent* completion, | 253 CompletionEvent* completion, |
| 228 LayerTreeHost* layer_tree_host, | 254 LayerTreeHost* layer_tree_host, |
| 229 base::TimeTicks main_thread_start_time, | 255 base::TimeTicks main_thread_start_time, |
| 230 bool hold_commit_for_activation) { | 256 bool hold_commit_for_activation) { |
| 231 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToCommitOnImpl"); | 257 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToCommitOnImpl"); |
| 232 DCHECK(!commit_completion_event_); | 258 DCHECK(!commit_completion_event_); |
| 233 DCHECK(IsImplThread() && IsMainThreadBlocked()); | 259 DCHECK(IsImplThread() && IsMainThreadBlocked()); |
| 234 DCHECK(scheduler_); | 260 DCHECK(scheduler_); |
| 235 DCHECK(scheduler_->CommitPending()); | 261 DCHECK(scheduler_->CommitPending()); |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 675 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 650 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 676 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 651 return main_thread_blocked_commit_vars_unsafe_; | 677 return main_thread_blocked_commit_vars_unsafe_; |
| 652 } | 678 } |
| 653 | 679 |
| 654 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { | 680 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { |
| 655 return task_runner_provider_->MainThreadTaskRunner(); | 681 return task_runner_provider_->MainThreadTaskRunner(); |
| 656 } | 682 } |
| 657 | 683 |
| 658 } // namespace cc | 684 } // namespace cc |
| OLD | NEW |