| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/output/output_surface.h" | 5 #include "cc/output/output_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 clip, | 97 clip, |
| 98 viewport_rect_for_tile_priority, | 98 viewport_rect_for_tile_priority, |
| 99 transform_for_tile_priority, | 99 transform_for_tile_priority, |
| 100 resourceless_software_draw); | 100 resourceless_software_draw); |
| 101 } | 101 } |
| 102 | 102 |
| 103 OutputSurface::~OutputSurface() { | 103 OutputSurface::~OutputSurface() { |
| 104 if (context_provider_.get()) { | 104 if (context_provider_.get()) { |
| 105 context_provider_->SetLostContextCallback( | 105 context_provider_->SetLostContextCallback( |
| 106 ContextProvider::LostContextCallback()); | 106 ContextProvider::LostContextCallback()); |
| 107 context_provider_->SetMemoryPolicyChangedCallback( | |
| 108 ContextProvider::MemoryPolicyChangedCallback()); | |
| 109 } | 107 } |
| 110 } | 108 } |
| 111 | 109 |
| 112 bool OutputSurface::HasExternalStencilTest() const { | 110 bool OutputSurface::HasExternalStencilTest() const { |
| 113 return external_stencil_test_enabled_; | 111 return external_stencil_test_enabled_; |
| 114 } | 112 } |
| 115 | 113 |
| 116 bool OutputSurface::BindToClient(OutputSurfaceClient* client) { | 114 bool OutputSurface::BindToClient(OutputSurfaceClient* client) { |
| 117 DCHECK(client); | 115 DCHECK(client); |
| 118 client_ = client; | 116 client_ = client; |
| 119 bool success = true; | 117 bool success = true; |
| 120 | 118 |
| 121 if (context_provider_.get()) { | 119 if (context_provider_.get()) { |
| 122 success = context_provider_->BindToCurrentThread(); | 120 success = context_provider_->BindToCurrentThread(); |
| 123 if (success) { | 121 if (success) { |
| 124 context_provider_->SetLostContextCallback(base::Bind( | 122 context_provider_->SetLostContextCallback(base::Bind( |
| 125 &OutputSurface::DidLoseOutputSurface, base::Unretained(this))); | 123 &OutputSurface::DidLoseOutputSurface, base::Unretained(this))); |
| 126 context_provider_->SetMemoryPolicyChangedCallback( | |
| 127 base::Bind(&OutputSurface::SetMemoryPolicy, base::Unretained(this))); | |
| 128 } | 124 } |
| 129 } | 125 } |
| 130 | 126 |
| 131 if (success && worker_context_provider_.get()) { | 127 if (success && worker_context_provider_.get()) { |
| 132 success = worker_context_provider_->BindToCurrentThread(); | 128 success = worker_context_provider_->BindToCurrentThread(); |
| 133 if (success) | 129 if (success) |
| 134 worker_context_provider_->SetupLock(); | 130 worker_context_provider_->SetupLock(); |
| 135 } | 131 } |
| 136 | 132 |
| 137 if (!success) | 133 if (!success) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 aggressively_free_resources); | 214 aggressively_free_resources); |
| 219 } | 215 } |
| 220 } | 216 } |
| 221 } | 217 } |
| 222 | 218 |
| 223 bool OutputSurface::SurfaceIsSuspendForRecycle() const { | 219 bool OutputSurface::SurfaceIsSuspendForRecycle() const { |
| 224 return false; | 220 return false; |
| 225 } | 221 } |
| 226 | 222 |
| 227 } // namespace cc | 223 } // namespace cc |
| OLD | NEW |