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

Side by Side Diff: chrome/browser/renderer_host/accelerated_surface_container_mac.cc

Issue 1110011: Fixed missing code in EnqueueTextureForDeletion.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/accelerated_surface_container_mac.h" 5 #include "chrome/browser/renderer_host/accelerated_surface_container_mac.h"
6 6
7 #include "app/surface/io_surface_support_mac.h" 7 #include "app/surface/io_surface_support_mac.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "webkit/glue/webplugin.h" 9 #include "webkit/glue/webplugin.h"
10 #include "chrome/browser/renderer_host/accelerated_surface_container_manager_mac .h" 10 #include "chrome/browser/renderer_host/accelerated_surface_container_manager_mac .h"
11 11
12 AcceleratedSurfaceContainerMac::AcceleratedSurfaceContainerMac() 12 AcceleratedSurfaceContainerMac::AcceleratedSurfaceContainerMac(
13 : x_(0), 13 AcceleratedSurfaceContainerManagerMac* manager)
14 : manager_(manager),
15 x_(0),
14 y_(0), 16 y_(0),
15 surface_(NULL), 17 surface_(NULL),
16 width_(0), 18 width_(0),
17 height_(0), 19 height_(0),
18 texture_(0), 20 texture_(0),
19 texture_needs_upload_(true) { 21 texture_needs_upload_(true) {
20 } 22 }
21 23
22 AcceleratedSurfaceContainerMac::~AcceleratedSurfaceContainerMac() { 24 AcceleratedSurfaceContainerMac::~AcceleratedSurfaceContainerMac() {
25 EnqueueTextureForDeletion();
23 ReleaseIOSurface(); 26 ReleaseIOSurface();
24 } 27 }
25 28
26 void AcceleratedSurfaceContainerMac::ReleaseIOSurface() { 29 void AcceleratedSurfaceContainerMac::ReleaseIOSurface() {
27 if (surface_) { 30 if (surface_) {
28 CFRelease(surface_); 31 CFRelease(surface_);
29 surface_ = NULL; 32 surface_ = NULL;
30 } 33 }
31 } 34 }
32 35
33 void AcceleratedSurfaceContainerMac::SetSizeAndIOSurface( 36 void AcceleratedSurfaceContainerMac::SetSizeAndIOSurface(
34 int32 width, 37 int32 width,
35 int32 height, 38 int32 height,
36 uint64 io_surface_identifier, 39 uint64 io_surface_identifier) {
37 AcceleratedSurfaceContainerManagerMac* manager) {
38 ReleaseIOSurface(); 40 ReleaseIOSurface();
39 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); 41 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize();
40 if (io_surface_support) { 42 if (io_surface_support) {
41 surface_ = io_surface_support->IOSurfaceLookup( 43 surface_ = io_surface_support->IOSurfaceLookup(
42 static_cast<uint32>(io_surface_identifier)); 44 static_cast<uint32>(io_surface_identifier));
43 EnqueueTextureForDeletion(manager); 45 EnqueueTextureForDeletion();
44 width_ = width; 46 width_ = width;
45 height_ = height; 47 height_ = height;
46 } 48 }
47 } 49 }
48 50
49 void AcceleratedSurfaceContainerMac::SetSizeAndTransportDIB( 51 void AcceleratedSurfaceContainerMac::SetSizeAndTransportDIB(
50 int32 width, 52 int32 width,
51 int32 height, 53 int32 height,
52 TransportDIB::Handle transport_dib, 54 TransportDIB::Handle transport_dib) {
53 AcceleratedSurfaceContainerManagerMac* manager) {
54 if (TransportDIB::is_valid(transport_dib)) { 55 if (TransportDIB::is_valid(transport_dib)) {
55 transport_dib_.reset(TransportDIB::Map(transport_dib)); 56 transport_dib_.reset(TransportDIB::Map(transport_dib));
56 EnqueueTextureForDeletion(manager); 57 EnqueueTextureForDeletion();
57 width_ = width; 58 width_ = width;
58 height_ = height; 59 height_ = height;
59 } 60 }
60 } 61 }
61 62
62 void AcceleratedSurfaceContainerMac::MoveTo( 63 void AcceleratedSurfaceContainerMac::MoveTo(
63 const webkit_glue::WebPluginGeometry& geom) { 64 const webkit_glue::WebPluginGeometry& geom) {
64 x_ = geom.window_rect.x(); 65 x_ = geom.window_rect.x();
65 y_ = geom.window_rect.y(); 66 y_ = geom.window_rect.y();
66 // TODO(kbr): may need to pay attention to cutout rects. 67 // TODO(kbr): may need to pay attention to cutout rects.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 glVertex3f(x + clipWidth, y, 0); 148 glVertex3f(x + clipWidth, y, 0);
148 glTexCoord2f(clipX, height_ - clipY - clipHeight); 149 glTexCoord2f(clipX, height_ - clipY - clipHeight);
149 glVertex3f(x, y + clipHeight, 0); 150 glVertex3f(x, y + clipHeight, 0);
150 glTexCoord2f(clipX + clipWidth, height_ - clipY - clipHeight); 151 glTexCoord2f(clipX + clipWidth, height_ - clipY - clipHeight);
151 glVertex3f(x + clipWidth, y + clipHeight, 0); 152 glVertex3f(x + clipWidth, y + clipHeight, 0);
152 glEnd(); 153 glEnd();
153 glDisable(target); 154 glDisable(target);
154 } 155 }
155 } 156 }
156 157
157 void AcceleratedSurfaceContainerMac::EnqueueTextureForDeletion( 158 void AcceleratedSurfaceContainerMac::EnqueueTextureForDeletion() {
158 AcceleratedSurfaceContainerManagerMac* manager) { 159 if (texture_) {
159 manager->EnqueueTextureForDeletion(texture_); 160 manager_->EnqueueTextureForDeletion(texture_);
160 texture_ = 0; 161 texture_ = 0;
162 }
161 } 163 }
162 164
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698