提交 c5d8cbc5 编写于 作者: E Eric Seidel

Fix two crashes when resuming apps

@abarth
上级 3038349d
...@@ -71,10 +71,15 @@ void Rasterizer::DrawPicture(SkPicture* picture) { ...@@ -71,10 +71,15 @@ void Rasterizer::DrawPicture(SkPicture* picture) {
} }
void Rasterizer::OnOutputSurfaceDestroyed() { void Rasterizer::OnOutputSurfaceDestroyed() {
CHECK(context_->MakeCurrent(surface_.get())); if (context_) {
ganesh_surface_.reset(); CHECK(context_->MakeCurrent(surface_.get()));
ganesh_context_.reset(); ganesh_surface_.reset();
context_ = nullptr; ganesh_context_.reset();
context_ = nullptr;
}
CHECK(!ganesh_surface_);
CHECK(!ganesh_context_);
CHECK(!context_);
surface_ = nullptr; surface_ = nullptr;
} }
......
...@@ -48,7 +48,6 @@ void Animator::RequestFrame() { ...@@ -48,7 +48,6 @@ void Animator::RequestFrame() {
void Animator::Stop() { void Animator::Stop() {
paused_ = true; paused_ = true;
engine_requested_frame_ = false;
} }
void Animator::Start() { void Animator::Start() {
...@@ -59,11 +58,16 @@ void Animator::Start() { ...@@ -59,11 +58,16 @@ void Animator::Start() {
void Animator::BeginFrame(int64_t time_stamp) { void Animator::BeginFrame(int64_t time_stamp) {
TRACE_EVENT_ASYNC_END0("sky", "Frame request pending", this); TRACE_EVENT_ASYNC_END0("sky", "Frame request pending", this);
DCHECK(engine_requested_frame_); DCHECK(engine_requested_frame_);
engine_requested_frame_ = false;
DCHECK(outstanding_requests_ > 0); DCHECK(outstanding_requests_ > 0);
DCHECK(outstanding_requests_ <= kPipelineDepth) << outstanding_requests_; DCHECK(outstanding_requests_ <= kPipelineDepth) << outstanding_requests_;
engine_requested_frame_ = false;
if (paused_) {
OnFrameComplete();
return;
}
base::TimeTicks frame_time = time_stamp ? base::TimeTicks frame_time = time_stamp ?
base::TimeTicks::FromInternalValue(time_stamp) : base::TimeTicks::Now(); base::TimeTicks::FromInternalValue(time_stamp) : base::TimeTicks::Now();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册