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

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

Issue 4142004: Let every "accelerated IO surface swapped" message have an identifier of the surface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 10 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
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 "chrome/browser/renderer_host/accelerated_surface_container_manager_mac .h" 9 #include "chrome/browser/renderer_host/accelerated_surface_container_manager_mac .h"
10 #include "webkit/glue/plugins/webplugin.h" 10 #include "webkit/glue/plugins/webplugin.h"
11 11
12 AcceleratedSurfaceContainerMac::AcceleratedSurfaceContainerMac( 12 AcceleratedSurfaceContainerMac::AcceleratedSurfaceContainerMac(
13 AcceleratedSurfaceContainerManagerMac* manager, 13 AcceleratedSurfaceContainerManagerMac* manager,
14 bool opaque) 14 bool opaque)
15 : manager_(manager), 15 : manager_(manager),
16 opaque_(opaque), 16 opaque_(opaque),
17 surface_id_(0),
17 width_(0), 18 width_(0),
18 height_(0), 19 height_(0),
19 texture_(0), 20 texture_(0),
20 texture_needs_upload_(true), 21 texture_needs_upload_(true),
21 texture_pending_deletion_(0), 22 texture_pending_deletion_(0),
22 visible_(false), 23 visible_(false),
23 was_painted_to_(false) { 24 was_painted_to_(false) {
24 } 25 }
25 26
26 AcceleratedSurfaceContainerMac::~AcceleratedSurfaceContainerMac() { 27 AcceleratedSurfaceContainerMac::~AcceleratedSurfaceContainerMac() {
27 } 28 }
28 29
29 void AcceleratedSurfaceContainerMac::SetSizeAndIOSurface( 30 void AcceleratedSurfaceContainerMac::SetSizeAndIOSurface(
30 int32 width, 31 int32 width,
31 int32 height, 32 int32 height,
32 uint64 io_surface_identifier) { 33 uint64 io_surface_identifier) {
33 surface_.reset(); 34 surface_.reset();
35 surface_id_ = 0;
34 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); 36 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize();
35 if (io_surface_support) { 37 if (io_surface_support) {
36 surface_.reset(io_surface_support->IOSurfaceLookup( 38 surface_.reset(io_surface_support->IOSurfaceLookup(
37 static_cast<uint32>(io_surface_identifier))); 39 static_cast<uint32>(io_surface_identifier)));
40 if (surface_.get())
41 surface_id_ = io_surface_identifier;
38 EnqueueTextureForDeletion(); 42 EnqueueTextureForDeletion();
39 width_ = width; 43 width_ = width;
40 height_ = height; 44 height_ = height;
41 } 45 }
42 } 46 }
43 47
44 void AcceleratedSurfaceContainerMac::SetSizeAndTransportDIB( 48 void AcceleratedSurfaceContainerMac::SetSizeAndTransportDIB(
45 int32 width, 49 int32 width,
46 int32 height, 50 int32 height,
47 TransportDIB::Handle transport_dib) { 51 TransportDIB::Handle transport_dib) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 glVertex3f(0, clipHeight, 0); 189 glVertex3f(0, clipHeight, 0);
186 190
187 glTexCoord2f(clipX + clipWidth, height_ - clipY - clipHeight); 191 glTexCoord2f(clipX + clipWidth, height_ - clipY - clipHeight);
188 glVertex3f(clipWidth, clipHeight, 0); 192 glVertex3f(clipWidth, clipHeight, 0);
189 193
190 glEnd(); 194 glEnd();
191 glDisable(target); 195 glDisable(target);
192 } 196 }
193 } 197 }
194 198
199 void AcceleratedSurfaceContainerMac::set_was_painted_to(uint64 surface_id) {
200 if (surface_id) {
201 // Check that only the most current IOSurface allocated for this container
202 // is painted to.
203 DCHECK(surface_);
204 DCHECK_EQ(surface_id, surface_id_);
205 }
206 was_painted_to_ = true;
207 }
208
195 void AcceleratedSurfaceContainerMac::EnqueueTextureForDeletion() { 209 void AcceleratedSurfaceContainerMac::EnqueueTextureForDeletion() {
196 if (texture_) { 210 if (texture_) {
197 DCHECK(texture_pending_deletion_ == 0); 211 DCHECK(texture_pending_deletion_ == 0);
198 texture_pending_deletion_ = texture_; 212 texture_pending_deletion_ = texture_;
199 texture_ = 0; 213 texture_ = 0;
200 } 214 }
201 } 215 }
202 216
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698