Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / browser / aura / no_transport_image_transport_factory.cc
blob6fa80c6909515ad56bf37a999cdee61baacdd73b
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
3 // found in the LICENSE file.
5 #include "content/browser/aura/no_transport_image_transport_factory.h"
7 #include "cc/output/context_provider.h"
8 #include "content/common/gpu/client/gl_helper.h"
9 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
10 #include "ui/compositor/compositor.h"
12 namespace content {
14 namespace {
16 class FakeTexture : public ui::Texture {
17 public:
18 FakeTexture(scoped_refptr<cc::ContextProvider> context_provider,
19 float device_scale_factor)
20 : ui::Texture(false, gfx::Size(), device_scale_factor),
21 context_provider_(context_provider),
22 texture_(context_provider_->Context3d()->createTexture()) {}
24 virtual unsigned int PrepareTexture() OVERRIDE { return texture_; }
25 virtual WebKit::WebGraphicsContext3D* HostContext3D() OVERRIDE {
26 return context_provider_->Context3d();
29 virtual void Consume(const std::string& mailbox_name,
30 const gfx::Size& new_size) OVERRIDE {
31 size_ = new_size;
34 private:
35 virtual ~FakeTexture() {
36 context_provider_->Context3d()->deleteTexture(texture_);
39 scoped_refptr<cc::ContextProvider> context_provider_;
40 unsigned texture_;
41 DISALLOW_COPY_AND_ASSIGN(FakeTexture);
44 } // anonymous namespace
46 NoTransportImageTransportFactory::NoTransportImageTransportFactory(
47 ui::ContextFactory* context_factory)
48 : context_factory_(context_factory),
49 context_provider_(
50 context_factory_->OffscreenContextProviderForMainThread()) {}
52 NoTransportImageTransportFactory::~NoTransportImageTransportFactory() {}
54 ui::ContextFactory* NoTransportImageTransportFactory::AsContextFactory() {
55 return context_factory_.get();
58 gfx::GLSurfaceHandle
59 NoTransportImageTransportFactory::CreateSharedSurfaceHandle() {
60 return gfx::GLSurfaceHandle();
63 void NoTransportImageTransportFactory::DestroySharedSurfaceHandle(
64 gfx::GLSurfaceHandle surface) {}
66 scoped_refptr<ui::Texture>
67 NoTransportImageTransportFactory::CreateTransportClient(
68 float device_scale_factor) {
69 return new FakeTexture(context_provider_, device_scale_factor);
72 scoped_refptr<ui::Texture> NoTransportImageTransportFactory::CreateOwnedTexture(
73 const gfx::Size& size,
74 float device_scale_factor,
75 unsigned int texture_id) {
76 return NULL;
79 GLHelper* NoTransportImageTransportFactory::GetGLHelper() {
80 if (!gl_helper_)
81 gl_helper_.reset(new GLHelper(context_provider_->Context3d()));
82 return gl_helper_.get();
85 uint32 NoTransportImageTransportFactory::InsertSyncPoint() { return 0; }
87 void NoTransportImageTransportFactory::WaitSyncPoint(uint32 sync_point) {}
89 // We don't generate lost context events, so we don't need to keep track of
90 // observers
91 void NoTransportImageTransportFactory::AddObserver(
92 ImageTransportFactoryObserver* observer) {}
94 void NoTransportImageTransportFactory::RemoveObserver(
95 ImageTransportFactoryObserver* observer) {}
97 } // namespace content