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

Side by Side Diff: content/browser/renderer_host/accelerated_surface_container_linux_cc.cc

Issue 8463018: Use ScopedMakeCurrent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer comments Created 9 years, 1 month 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
« no previous file with comments | « no previous file | content/browser/renderer_host/image_transport_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer_host/accelerated_surface_container_linux.h" 5 #include "content/browser/renderer_host/accelerated_surface_container_linux.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "content/browser/renderer_host/image_transport_client.h" 8 #include "content/browser/renderer_host/image_transport_client.h"
9 #include "ui/gfx/compositor/compositor_cc.h" 9 #include "ui/gfx/compositor/compositor_cc.h"
10 #include "ui/gfx/gl/scoped_make_current.h"
10 #include "ui/gfx/rect.h" 11 #include "ui/gfx/rect.h"
11 #include "ui/gfx/transform.h" 12 #include "ui/gfx/transform.h"
12 13
13 namespace { 14 namespace {
14 15
15 class AcceleratedSurfaceContainerLinuxCC 16 class AcceleratedSurfaceContainerLinuxCC
16 : public AcceleratedSurfaceContainerLinux, public ui::TextureCC { 17 : public AcceleratedSurfaceContainerLinux, public ui::TextureCC {
17 public: 18 public:
18 explicit AcceleratedSurfaceContainerLinuxCC(const gfx::Size& size) 19 explicit AcceleratedSurfaceContainerLinuxCC(const gfx::Size& size)
19 : size_(size), 20 : size_(size),
(...skipping 22 matching lines...) Expand all
42 return false; 43 return false;
43 } 44 }
44 flipped_ = image_transport_client_->Flipped(); 45 flipped_ = image_transport_client_->Flipped();
45 return true; 46 return true;
46 } 47 }
47 48
48 // TextureCC implementation 49 // TextureCC implementation
49 virtual void Update() OVERRIDE { 50 virtual void Update() OVERRIDE {
50 ui::SharedResourcesCC* instance = ui::SharedResourcesCC::GetInstance(); 51 ui::SharedResourcesCC* instance = ui::SharedResourcesCC::GetInstance();
51 DCHECK(instance); 52 DCHECK(instance);
52 instance->MakeSharedContextCurrent(); 53 scoped_ptr<gfx::ScopedMakeCurrent> bind(instance->GetScopedMakeCurrent());
53 if (acquired_) 54 if (acquired_)
54 image_transport_client_->Release(); 55 image_transport_client_->Release();
55 else 56 else
56 acquired_ = true; 57 acquired_ = true;
57 image_transport_client_->Acquire(); 58 image_transport_client_->Acquire();
58 } 59 }
59 60
60 virtual TransportDIB::Handle Handle() const { 61 virtual TransportDIB::Handle Handle() const {
61 return image_transport_client_->Handle(); 62 return image_transport_client_->Handle();
62 } 63 }
63 64
64 virtual ui::Texture* GetTexture() { return this; } 65 virtual ui::Texture* GetTexture() { return this; }
65 66
66 private: 67 private:
67 scoped_ptr<ImageTransportClient> image_transport_client_; 68 scoped_ptr<ImageTransportClient> image_transport_client_;
68 gfx::Size size_; 69 gfx::Size size_;
69 bool acquired_; 70 bool acquired_;
70 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerLinuxCC); 71 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerLinuxCC);
71 }; 72 };
72 73
73 } // namespace 74 } // namespace
74 75
75 // static 76 // static
76 AcceleratedSurfaceContainerLinux* 77 AcceleratedSurfaceContainerLinux*
77 AcceleratedSurfaceContainerLinux::Create(const gfx::Size& size) { 78 AcceleratedSurfaceContainerLinux::Create(const gfx::Size& size) {
78 return new AcceleratedSurfaceContainerLinuxCC(size); 79 return new AcceleratedSurfaceContainerLinuxCC(size);
79 } 80 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/image_transport_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698