| 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 "content/browser/aura/no_transport_image_transport_factory.h" | 5 #include "content/browser/aura/no_transport_image_transport_factory.h" |
| 6 | 6 |
| 7 #include "cc/output/context_provider.h" | 7 #include "cc/output/context_provider.h" |
| 8 #include "content/common/gpu/client/gl_helper.h" | 8 #include "content/common/gpu/client/gl_helper.h" |
| 9 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 9 #include "gpu/command_buffer/client/gles2_interface.h" |
| 10 #include "ui/compositor/compositor.h" | 10 #include "ui/compositor/compositor.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class FakeTexture : public ui::Texture { | 16 class FakeTexture : public ui::Texture { |
| 17 public: | 17 public: |
| 18 FakeTexture(scoped_refptr<cc::ContextProvider> context_provider, | 18 FakeTexture(scoped_refptr<cc::ContextProvider> context_provider, |
| 19 float device_scale_factor) | 19 float device_scale_factor) |
| 20 : ui::Texture(false, gfx::Size(), device_scale_factor), | 20 : ui::Texture(false, gfx::Size(), device_scale_factor), |
| 21 context_provider_(context_provider), | 21 context_provider_(context_provider), |
| 22 texture_(context_provider_->Context3d()->createTexture()) {} | 22 texture_(0u) { |
| 23 context_provider_->ContextGL()->GenTextures(1, &texture_); |
| 24 } |
| 23 | 25 |
| 24 virtual unsigned int PrepareTexture() OVERRIDE { return texture_; } | 26 virtual unsigned int PrepareTexture() OVERRIDE { return texture_; } |
| 25 | 27 |
| 26 virtual void Consume(const std::string& mailbox_name, | 28 virtual void Consume(const std::string& mailbox_name, |
| 27 const gfx::Size& new_size) OVERRIDE { | 29 const gfx::Size& new_size) OVERRIDE { |
| 28 size_ = new_size; | 30 size_ = new_size; |
| 29 } | 31 } |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 virtual ~FakeTexture() { | 34 virtual ~FakeTexture() { |
| 33 context_provider_->Context3d()->deleteTexture(texture_); | 35 context_provider_->ContextGL()->DeleteTextures(1, &texture_); |
| 34 } | 36 } |
| 35 | 37 |
| 36 scoped_refptr<cc::ContextProvider> context_provider_; | 38 scoped_refptr<cc::ContextProvider> context_provider_; |
| 37 unsigned texture_; | 39 unsigned texture_; |
| 38 DISALLOW_COPY_AND_ASSIGN(FakeTexture); | 40 DISALLOW_COPY_AND_ASSIGN(FakeTexture); |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 } // anonymous namespace | 43 } // anonymous namespace |
| 42 | 44 |
| 43 NoTransportImageTransportFactory::NoTransportImageTransportFactory( | 45 NoTransportImageTransportFactory::NoTransportImageTransportFactory( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 89 |
| 88 // We don't generate lost context events, so we don't need to keep track of | 90 // We don't generate lost context events, so we don't need to keep track of |
| 89 // observers | 91 // observers |
| 90 void NoTransportImageTransportFactory::AddObserver( | 92 void NoTransportImageTransportFactory::AddObserver( |
| 91 ImageTransportFactoryObserver* observer) {} | 93 ImageTransportFactoryObserver* observer) {} |
| 92 | 94 |
| 93 void NoTransportImageTransportFactory::RemoveObserver( | 95 void NoTransportImageTransportFactory::RemoveObserver( |
| 94 ImageTransportFactoryObserver* observer) {} | 96 ImageTransportFactoryObserver* observer) {} |
| 95 | 97 |
| 96 } // namespace content | 98 } // namespace content |
| OLD | NEW |