Merge pull request #384 from eseidelGoogle/resume_crash

Fix two crashes when resuming apps
This commit is contained in:
Eric Seidel 2015-07-30 13:25:56 -07:00
commit f6bfb420e5
2 changed files with 16 additions and 7 deletions

View File

@ -71,10 +71,15 @@ void Rasterizer::DrawPicture(SkPicture* picture) {
}
void Rasterizer::OnOutputSurfaceDestroyed() {
CHECK(context_->MakeCurrent(surface_.get()));
ganesh_surface_.reset();
ganesh_context_.reset();
context_ = nullptr;
if (context_) {
CHECK(context_->MakeCurrent(surface_.get()));
ganesh_surface_.reset();
ganesh_context_.reset();
context_ = nullptr;
}
CHECK(!ganesh_surface_);
CHECK(!ganesh_context_);
CHECK(!context_);
surface_ = nullptr;
}

View File

@ -48,7 +48,6 @@ void Animator::RequestFrame() {
void Animator::Stop() {
paused_ = true;
engine_requested_frame_ = false;
}
void Animator::Start() {
@ -59,11 +58,16 @@ void Animator::Start() {
void Animator::BeginFrame(int64_t time_stamp) {
TRACE_EVENT_ASYNC_END0("sky", "Frame request pending", this);
DCHECK(engine_requested_frame_);
engine_requested_frame_ = false;
DCHECK(outstanding_requests_ > 0);
DCHECK(outstanding_requests_ <= kPipelineDepth) << outstanding_requests_;
engine_requested_frame_ = false;
if (paused_) {
OnFrameComplete();
return;
}
base::TimeTicks frame_time = time_stamp ?
base::TimeTicks::FromInternalValue(time_stamp) : base::TimeTicks::Now();