Linux: Fix assertions while running dialog boxes (issue #1822)

This commit is contained in:
Marshall Greenblatt
2016-01-27 09:11:59 -08:00
parent d94bfc5a98
commit e207b1758b
3 changed files with 100 additions and 0 deletions

View File

@@ -250,4 +250,16 @@ patches = [
'name': 'network_change_125097',
'path': '../net/base/',
},
{
# Fix ChildDiscardableSharedMemoryManager assertion on Linux.
# https://code.google.com/p/chromium/issues/detail?id=474165
'name': 'child_shutdown_474165',
'path': '../content/',
},
{
# Fix IdleTimeEstimator assertion on Linux.
# https://code.google.com/p/chromium/issues/detail?id=543894
'name': 'idle_time_543894',
'path': '../components/scheduler/renderer/',
},
]

View File

@@ -0,0 +1,47 @@
diff --git child/child_thread_impl.cc child/child_thread_impl.cc
index 782c5d5..d1de033 100644
--- child/child_thread_impl.cc
+++ child/child_thread_impl.cc
@@ -512,10 +512,6 @@ void ChildThreadImpl::Init(const Options& options) {
}
ChildThreadImpl::~ChildThreadImpl() {
- // ChildDiscardableSharedMemoryManager has to be destroyed while
- // |thread_safe_sender_| is still valid.
- discardable_shared_memory_manager_.reset();
-
#ifdef IPC_MESSAGE_LOG_ENABLED
IPC::Logging::GetInstance()->SetIPCSender(NULL);
#endif
@@ -541,6 +537,9 @@ void ChildThreadImpl::Shutdown() {
file_system_dispatcher_.reset();
quota_dispatcher_.reset();
WebFileSystemImpl::DeleteThreadSpecificInstance();
+ // ChildDiscardableSharedMemoryManager has to be destroyed while
+ // |thread_safe_sender_| is still valid.
+ discardable_shared_memory_manager_.reset();
}
void ChildThreadImpl::OnChannelConnected(int32 peer_pid) {
diff --git renderer/render_thread_impl.cc renderer/render_thread_impl.cc
index aa5828c..52f65b1 100644
--- renderer/render_thread_impl.cc
+++ renderer/render_thread_impl.cc
@@ -765,8 +765,6 @@ void RenderThreadImpl::Shutdown() {
FOR_EACH_OBSERVER(
RenderProcessObserver, observers_, OnRenderProcessShutdown());
- ChildThreadImpl::Shutdown();
-
if (memory_observer_) {
message_loop()->RemoveTaskObserver(memory_observer_.get());
memory_observer_.reset();
@@ -857,6 +855,8 @@ void RenderThreadImpl::Shutdown() {
NPChannelBase::CleanupChannels();
#endif
+ ChildThreadImpl::Shutdown();
+
// Shut down the message loop and the renderer scheduler before shutting down
// Blink. This prevents a scenario where a pending task in the message loop
// accesses Blink objects after Blink shuts down.

View File

@@ -0,0 +1,41 @@
diff --git idle_time_estimator.cc idle_time_estimator.cc
index 5d572a2..52e72da 100644
--- idle_time_estimator.cc
+++ idle_time_estimator.cc
@@ -36,7 +36,8 @@ base::TimeDelta IdleTimeEstimator::GetExpectedIdleDuration(
void IdleTimeEstimator::DidCommitFrameToCompositor() {
// This will run inside of a WillProcessTask / DidProcessTask pair, let
// DidProcessTask know a frame was comitted.
- did_commit_ = true;
+ if (nesting_level_ == 1)
+ did_commit_ = true;
}
void IdleTimeEstimator::Clear() {
@@ -54,11 +55,16 @@ void IdleTimeEstimator::SetTimeSourceForTesting(
void IdleTimeEstimator::WillProcessTask(const base::PendingTask& pending_task) {
nesting_level_++;
- task_start_time_ = time_source_->NowTicks();
+ if (nesting_level_ == 1)
+ task_start_time_ = time_source_->NowTicks();
}
void IdleTimeEstimator::DidProcessTask(const base::PendingTask& pending_task) {
- DCHECK_EQ(nesting_level_, 1);
+ nesting_level_--;
+ DCHECK_GE(nesting_level_, 0);
+ if (nesting_level_ != 0)
+ return;
+
cumulative_compositor_runtime_ += time_source_->NowTicks() - task_start_time_;
if (did_commit_) {
@@ -67,7 +73,6 @@ void IdleTimeEstimator::DidProcessTask(const base::PendingTask& pending_task) {
cumulative_compositor_runtime_ = base::TimeDelta();
did_commit_ = false;
}
- nesting_level_--;
}
} // namespace scheduler