| Index: cc/output/output_surface.cc
|
| diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
|
| index 3e1549701e9ba6fdcedc4ed401fb66fd2e699105..52f20a01a24ac26cb2f819579d2cea9087ec8dc8 100644
|
| --- a/cc/output/output_surface.cc
|
| +++ b/cc/output/output_surface.cc
|
| @@ -119,12 +119,12 @@ class SkiaGpuTraceMemoryDump : public SkTraceMemoryDump {
|
| } // namespace
|
|
|
| OutputSurface::OutputSurface(
|
| - scoped_refptr<ContextProvider> context_provider,
|
| + std::unique_ptr<ContextProvider::DeferredCreate> context_provider_create,
|
| scoped_refptr<ContextProvider> worker_context_provider,
|
| scoped_refptr<VulkanContextProvider> vulkan_context_provider,
|
| std::unique_ptr<SoftwareOutputDevice> software_device)
|
| : client_(NULL),
|
| - context_provider_(std::move(context_provider)),
|
| + context_provider_create_(std::move(context_provider_create)),
|
| worker_context_provider_(std::move(worker_context_provider)),
|
| vulkan_context_provider_(vulkan_context_provider),
|
| software_device_(std::move(software_device)),
|
| @@ -135,21 +135,20 @@ OutputSurface::OutputSurface(
|
| client_thread_checker_.DetachFromThread();
|
| }
|
|
|
| -OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider)
|
| - : OutputSurface(std::move(context_provider),
|
| +OutputSurface::OutputSurface(
|
| + std::unique_ptr<ContextProvider::DeferredCreate> context_provider_create)
|
| + : OutputSurface(std::move(context_provider_create),
|
| nullptr,
|
| nullptr,
|
| - nullptr) {
|
| -}
|
| + nullptr) {}
|
|
|
| OutputSurface::OutputSurface(
|
| - scoped_refptr<ContextProvider> context_provider,
|
| + std::unique_ptr<ContextProvider::DeferredCreate> context_provider_create,
|
| scoped_refptr<ContextProvider> worker_context_provider)
|
| - : OutputSurface(std::move(context_provider),
|
| + : OutputSurface(std::move(context_provider_create),
|
| std::move(worker_context_provider),
|
| nullptr,
|
| - nullptr) {
|
| -}
|
| + nullptr) {}
|
|
|
| OutputSurface::OutputSurface(
|
| std::unique_ptr<SoftwareOutputDevice> software_device)
|
| @@ -160,13 +159,12 @@ OutputSurface::OutputSurface(
|
| }
|
|
|
| OutputSurface::OutputSurface(
|
| - scoped_refptr<ContextProvider> context_provider,
|
| + std::unique_ptr<ContextProvider::DeferredCreate> context_provider_create,
|
| std::unique_ptr<SoftwareOutputDevice> software_device)
|
| - : OutputSurface(std::move(context_provider),
|
| + : OutputSurface(std::move(context_provider_create),
|
| nullptr,
|
| nullptr,
|
| - std::move(software_device)) {
|
| -}
|
| + std::move(software_device)) {}
|
|
|
| // Forwarded to OutputSurfaceClient
|
| void OutputSurface::SetNeedsRedrawRect(const gfx::Rect& damage_rect) {
|
| @@ -205,12 +203,15 @@ bool OutputSurface::BindToClient(OutputSurfaceClient* client) {
|
| client_ = client;
|
| bool success = true;
|
|
|
| - if (context_provider_.get()) {
|
| - success = context_provider_->BindToCurrentThread();
|
| - if (success) {
|
| + if (context_provider_create_) {
|
| + context_provider_ = context_provider_create_->CreateContext();
|
| + if (context_provider_) {
|
| context_provider_->SetLostContextCallback(base::Bind(
|
| &OutputSurface::DidLoseOutputSurface, base::Unretained(this)));
|
| }
|
| + success = !!context_provider_;
|
| + // Don't keep around the dead DeferredCreate.
|
| + context_provider_create_ = nullptr;
|
| }
|
|
|
| // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
|
|
|