Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/buffer.h" | 5 #include "components/exo/buffer.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 if (texture_ && texture_->IsLost()) | 425 if (texture_ && texture_->IsLost()) |
| 426 texture_.reset(); | 426 texture_.reset(); |
| 427 | 427 |
| 428 ui::ContextFactory* context_factory = | 428 ui::ContextFactory* context_factory = |
| 429 aura::Env::GetInstance()->context_factory(); | 429 aura::Env::GetInstance()->context_factory(); |
| 430 // Note: This can fail if GPU acceleration has been disabled. | 430 // Note: This can fail if GPU acceleration has been disabled. |
| 431 scoped_refptr<cc::ContextProvider> context_provider = | 431 scoped_refptr<cc::ContextProvider> context_provider = |
| 432 context_factory->SharedMainThreadContextProvider(); | 432 context_factory->SharedMainThreadContextProvider(); |
| 433 if (!context_provider) { | 433 if (!context_provider) { |
| 434 DLOG(WARNING) << "Failed to acquire a context provider"; | 434 DLOG(WARNING) << "Failed to acquire a context provider"; |
| 435 | |
|
Fady Samuel
2016/11/23 15:39:02
No need for code churn. Just restore this file to
Alex Z.
2016/11/23 17:46:09
Done.
| |
| 435 Release(); // Decrements the use count | 436 Release(); // Decrements the use count |
| 436 return nullptr; | 437 return nullptr; |
| 437 } | 438 } |
| 438 | 439 |
| 439 // Create a new image texture for |gpu_memory_buffer_| with |texture_target_| | 440 // Create a new image texture for |gpu_memory_buffer_| with |texture_target_| |
| 440 // if one doesn't already exist. The contents of this buffer are copied to | 441 // if one doesn't already exist. The contents of this buffer are copied to |
| 441 // |texture| using a call to CopyTexImage. | 442 // |texture| using a call to CopyTexImage. |
| 442 if (!contents_texture_) { | 443 if (!contents_texture_) { |
| 443 contents_texture_ = base::MakeUnique<Texture>( | 444 contents_texture_ = base::MakeUnique<Texture>( |
| 444 context_factory, context_provider.get(), gpu_memory_buffer_.get(), | 445 context_factory, context_provider.get(), gpu_memory_buffer_.get(), |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 if (!release_callback_.is_null()) | 536 if (!release_callback_.is_null()) |
| 536 release_callback_.Run(); | 537 release_callback_.Run(); |
| 537 } | 538 } |
| 538 | 539 |
| 539 void Buffer::ReleaseTexture(std::unique_ptr<Texture> texture) { | 540 void Buffer::ReleaseTexture(std::unique_ptr<Texture> texture) { |
| 540 texture_ = std::move(texture); | 541 texture_ = std::move(texture); |
| 541 } | 542 } |
| 542 | 543 |
| 543 void Buffer::ReleaseContentsTexture(std::unique_ptr<Texture> texture) { | 544 void Buffer::ReleaseContentsTexture(std::unique_ptr<Texture> texture) { |
| 544 TRACE_EVENT0("exo", "Buffer::ReleaseContentsTexture"); | 545 TRACE_EVENT0("exo", "Buffer::ReleaseContentsTexture"); |
| 545 | |
| 546 contents_texture_ = std::move(texture); | 546 contents_texture_ = std::move(texture); |
| 547 Release(); | 547 Release(); |
| 548 } | 548 } |
| 549 | 549 |
| 550 } // namespace exo | 550 } // namespace exo |
| OLD | NEW |