Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: content/browser/aura/no_transport_image_transport_factory.cc

Issue 137893007: Add the UI compositor to the Mac build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missed file Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "content/browser/aura/no_transport_image_transport_factory.h"
6
7 #include "cc/output/context_provider.h"
8 #include "content/common/gpu/client/gl_helper.h"
9 #include "gpu/command_buffer/client/gles2_interface.h"
10 #include "ui/compositor/compositor.h"
11
12 namespace content {
13
14 namespace {
15
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_(0u) {
23 context_provider_->ContextGL()->GenTextures(1, &texture_);
24 }
25
26 virtual unsigned int PrepareTexture() OVERRIDE { return texture_; }
27
28 virtual void Consume(const std::string& mailbox_name,
29 const gfx::Size& new_size) OVERRIDE {
30 size_ = new_size;
31 }
32
33 private:
34 virtual ~FakeTexture() {
35 context_provider_->ContextGL()->DeleteTextures(1, &texture_);
36 }
37
38 scoped_refptr<cc::ContextProvider> context_provider_;
39 unsigned texture_;
40 DISALLOW_COPY_AND_ASSIGN(FakeTexture);
41 };
42
43 } // anonymous namespace
44
45 NoTransportImageTransportFactory::NoTransportImageTransportFactory(
46 scoped_ptr<ui::ContextFactory> context_factory)
47 : context_factory_(context_factory.Pass()) {}
48
49 NoTransportImageTransportFactory::~NoTransportImageTransportFactory() {}
50
51 ui::ContextFactory* NoTransportImageTransportFactory::AsContextFactory() {
52 return context_factory_.get();
53 }
54
55 gfx::GLSurfaceHandle
56 NoTransportImageTransportFactory::GetSharedSurfaceHandle() {
57 return gfx::GLSurfaceHandle();
58 }
59
60 scoped_refptr<ui::Texture>
61 NoTransportImageTransportFactory::CreateTransportClient(
62 float device_scale_factor) {
63 return new FakeTexture(context_factory_->SharedMainThreadContextProvider(),
64 device_scale_factor);
65 }
66
67 scoped_refptr<ui::Texture> NoTransportImageTransportFactory::CreateOwnedTexture(
68 const gfx::Size& size,
69 float device_scale_factor,
70 unsigned int texture_id) {
71 return NULL;
72 }
73
74 GLHelper* NoTransportImageTransportFactory::GetGLHelper() {
75 if (!gl_helper_) {
76 context_provider_ = context_factory_->SharedMainThreadContextProvider();
77 gl_helper_.reset(new GLHelper(context_provider_->ContextGL(),
78 context_provider_->ContextSupport()));
79 }
80 return gl_helper_.get();
81 }
82
83 // We don't generate lost context events, so we don't need to keep track of
84 // observers
85 void NoTransportImageTransportFactory::AddObserver(
86 ImageTransportFactoryObserver* observer) {}
87
88 void NoTransportImageTransportFactory::RemoveObserver(
89 ImageTransportFactoryObserver* observer) {}
90
91 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/aura/no_transport_image_transport_factory.h ('k') | content/browser/aura/owned_mailbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698