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

Side by Side Diff: cc/output/copy_output_result.cc

Issue 19990007: Don't leak CopyResult textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/output/copy_output_result.h" 5 #include "cc/output/copy_output_result.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/resources/texture_mailbox.h" 8 #include "cc/resources/texture_mailbox.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 CopyOutputResult::CopyOutputResult() {} 13 CopyOutputResult::CopyOutputResult() {}
14 14
15 CopyOutputResult::CopyOutputResult(scoped_ptr<SkBitmap> bitmap) 15 CopyOutputResult::CopyOutputResult(scoped_ptr<SkBitmap> bitmap)
16 : size_(bitmap->width(), bitmap->height()), 16 : size_(bitmap->width(), bitmap->height()),
17 bitmap_(bitmap.Pass()) { 17 bitmap_(bitmap.Pass()) {
18 DCHECK(bitmap_); 18 DCHECK(bitmap_);
19 } 19 }
20 20
21 CopyOutputResult::CopyOutputResult(gfx::Size size, 21 CopyOutputResult::CopyOutputResult(gfx::Size size,
22 scoped_ptr<TextureMailbox> texture_mailbox) 22 scoped_ptr<TextureMailbox> texture_mailbox)
23 : size_(size), 23 : size_(size),
24 texture_mailbox_(texture_mailbox.Pass()) { 24 texture_mailbox_(texture_mailbox.Pass()) {
25 DCHECK(texture_mailbox_); 25 DCHECK(texture_mailbox_);
26 DCHECK(texture_mailbox_->IsTexture()); 26 DCHECK(texture_mailbox_->IsTexture());
27 } 27 }
28 28
29 CopyOutputResult::~CopyOutputResult() {} 29 CopyOutputResult::~CopyOutputResult() {
30 if (texture_mailbox_)
31 texture_mailbox_->RunReleaseCallback(0, false);
32 }
30 33
31 scoped_ptr<SkBitmap> CopyOutputResult::TakeBitmap() { 34 scoped_ptr<SkBitmap> CopyOutputResult::TakeBitmap() {
32 return bitmap_.Pass(); 35 return bitmap_.Pass();
33 } 36 }
34 37
35 scoped_ptr<TextureMailbox> CopyOutputResult::TakeTexture() { 38 scoped_ptr<TextureMailbox> CopyOutputResult::TakeTexture() {
36 return texture_mailbox_.Pass(); 39 return texture_mailbox_.Pass();
37 } 40 }
38 41
39 } // namespace cc 42 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698