| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 SetUpContext3d(); | 256 SetUpContext3d(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 if (!success) | 259 if (!success) |
| 260 client_ = NULL; | 260 client_ = NULL; |
| 261 | 261 |
| 262 return success; | 262 return success; |
| 263 } | 263 } |
| 264 | 264 |
| 265 bool OutputSurface::InitializeAndSetContext3d( | 265 bool OutputSurface::InitializeAndSetContext3d( |
| 266 scoped_refptr<ContextProvider> context_provider, | 266 scoped_refptr<ContextProvider> context_provider) { |
| 267 scoped_refptr<ContextProvider> offscreen_context_provider) { | |
| 268 DCHECK(!context_provider_); | 267 DCHECK(!context_provider_); |
| 269 DCHECK(context_provider); | 268 DCHECK(context_provider); |
| 270 DCHECK(client_); | 269 DCHECK(client_); |
| 271 | 270 |
| 272 bool success = false; | 271 bool success = false; |
| 273 if (context_provider->BindToCurrentThread()) { | 272 if (context_provider->BindToCurrentThread()) { |
| 274 context_provider_ = context_provider; | 273 context_provider_ = context_provider; |
| 275 SetUpContext3d(); | 274 SetUpContext3d(); |
| 276 if (client_->DeferredInitialize(offscreen_context_provider)) | 275 client_->DeferredInitialize(); |
| 277 success = true; | 276 success = true; |
| 278 } | 277 } |
| 279 | 278 |
| 280 if (!success) | 279 if (!success) |
| 281 ResetContext3d(); | 280 ResetContext3d(); |
| 282 | 281 |
| 283 return success; | 282 return success; |
| 284 } | 283 } |
| 285 | 284 |
| 286 void OutputSurface::ReleaseGL() { | 285 void OutputSurface::ReleaseGL() { |
| 287 DCHECK(client_); | 286 DCHECK(client_); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy", | 467 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy", |
| 469 "bytes_limit_when_visible", policy.bytes_limit_when_visible); | 468 "bytes_limit_when_visible", policy.bytes_limit_when_visible); |
| 470 // Just ignore the memory manager when it says to set the limit to zero | 469 // Just ignore the memory manager when it says to set the limit to zero |
| 471 // bytes. This will happen when the memory manager thinks that the renderer | 470 // bytes. This will happen when the memory manager thinks that the renderer |
| 472 // is not visible (which the renderer knows better). | 471 // is not visible (which the renderer knows better). |
| 473 if (policy.bytes_limit_when_visible) | 472 if (policy.bytes_limit_when_visible) |
| 474 client_->SetMemoryPolicy(policy); | 473 client_->SetMemoryPolicy(policy); |
| 475 } | 474 } |
| 476 | 475 |
| 477 } // namespace cc | 476 } // namespace cc |
| OLD | NEW |