summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rw-r--r--cc/output/output_surface.cc12
-rw-r--r--cc/output/output_surface.h5
-rw-r--r--cc/trees/layer_tree_host_impl.cc2
3 files changed, 16 insertions, 3 deletions
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index 749527e..9820ee28 100644
--- a/cc/output/output_surface.cc
+++ b/cc/output/output_surface.cc
@@ -55,7 +55,8 @@ OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider)
check_for_retroactive_begin_impl_frame_pending_(false),
external_stencil_test_enabled_(false),
weak_ptr_factory_(this),
- gpu_latency_history_(kGpuLatencyHistorySize) {}
+ gpu_latency_history_(kGpuLatencyHistorySize),
+ is_lost_(false) {}
OutputSurface::OutputSurface(
scoped_ptr<cc::SoftwareOutputDevice> software_device)
@@ -71,7 +72,8 @@ OutputSurface::OutputSurface(
check_for_retroactive_begin_impl_frame_pending_(false),
external_stencil_test_enabled_(false),
weak_ptr_factory_(this),
- gpu_latency_history_(kGpuLatencyHistorySize) {}
+ gpu_latency_history_(kGpuLatencyHistorySize),
+ is_lost_(false) {}
OutputSurface::OutputSurface(
scoped_refptr<ContextProvider> context_provider,
@@ -89,7 +91,8 @@ OutputSurface::OutputSurface(
check_for_retroactive_begin_impl_frame_pending_(false),
external_stencil_test_enabled_(false),
weak_ptr_factory_(this),
- gpu_latency_history_(kGpuLatencyHistorySize) {}
+ gpu_latency_history_(kGpuLatencyHistorySize),
+ is_lost_(false) {}
void OutputSurface::InitializeBeginImplFrameEmulation(
base::SingleThreadTaskRunner* task_runner,
@@ -242,8 +245,11 @@ void OutputSurface::DidLoseOutputSurface() {
pending_gpu_latency_query_ids_.clear();
available_gpu_latency_query_ids_.clear();
client_->DidLoseOutputSurface();
+ is_lost_ = true;
}
+bool OutputSurface::IsLost() { return is_lost_; }
+
void OutputSurface::SetExternalStencilTest(bool enabled) {
external_stencil_test_enabled_ = enabled;
}
diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h
index efe0ea2..7cafbd9 100644
--- a/cc/output/output_surface.h
+++ b/cc/output/output_surface.h
@@ -139,6 +139,9 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient {
// device is present, returns 0.
base::TimeDelta GpuLatencyEstimate();
+ // Has the output surface been lost.
+ bool IsLost();
+
protected:
// Synchronously initialize context3d and enter hardware mode.
// This can only supported in threaded compositing mode.
@@ -214,6 +217,8 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient {
std::deque<unsigned> pending_gpu_latency_query_ids_;
RollingTimeDeltaHistory gpu_latency_history_;
+ bool is_lost_;
+
DISALLOW_COPY_AND_ASSIGN(OutputSurface);
};
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 53afea7..0af1036 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1392,6 +1392,8 @@ void LayerTreeHostImpl::FinishAllRendering() {
bool LayerTreeHostImpl::IsContextLost() {
DCHECK(proxy_->IsImplThread());
+ if (output_surface_ && output_surface_->IsLost())
+ return true;
return renderer_ && renderer_->IsContextLost();
}