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

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

Issue 239183003: Trace the lifetime of CopyOutputRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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_request.h" 5 #include "cc/output/copy_output_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/output/copy_output_result.h" 10 #include "cc/output/copy_output_result.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 CopyOutputRequest::CopyOutputRequest() {} 30 CopyOutputRequest::CopyOutputRequest() {}
31 31
32 CopyOutputRequest::CopyOutputRequest( 32 CopyOutputRequest::CopyOutputRequest(
33 bool force_bitmap_result, 33 bool force_bitmap_result,
34 const CopyOutputRequestCallback& result_callback) 34 const CopyOutputRequestCallback& result_callback)
35 : force_bitmap_result_(force_bitmap_result), 35 : force_bitmap_result_(force_bitmap_result),
36 has_area_(false), 36 has_area_(false),
37 has_texture_mailbox_(false), 37 has_texture_mailbox_(false),
38 result_callback_(result_callback) {} 38 result_callback_(result_callback) {
39 DCHECK(!result_callback_.is_null());
40 TRACE_EVENT_ASYNC_BEGIN0("cc", "CopyOutputRequest", this);
41 }
39 42
40 CopyOutputRequest::~CopyOutputRequest() { 43 CopyOutputRequest::~CopyOutputRequest() {
41 if (!result_callback_.is_null()) 44 if (!result_callback_.is_null()) {
42 SendResult(CopyOutputResult::CreateEmptyResult().Pass()); 45 SendResult(CopyOutputResult::CreateEmptyResult().Pass());
46 TRACE_EVENT_ASYNC_END0("cc", "CopyOutputRequest", this);
jdduke (slow) 2014/04/25 17:36:00 Oops, forgot to delete this line.
47 }
43 } 48 }
44 49
45 void CopyOutputRequest::SendResult(scoped_ptr<CopyOutputResult> result) { 50 void CopyOutputRequest::SendResult(scoped_ptr<CopyOutputResult> result) {
46 base::ResetAndReturn(&result_callback_).Run(result.Pass()); 51 base::ResetAndReturn(&result_callback_).Run(result.Pass());
52 TRACE_EVENT_ASYNC_END0("cc", "CopyOutputRequest", this);
47 } 53 }
48 54
49 void CopyOutputRequest::SendEmptyResult() { 55 void CopyOutputRequest::SendEmptyResult() {
50 SendResult(CopyOutputResult::CreateEmptyResult().Pass()); 56 SendResult(CopyOutputResult::CreateEmptyResult().Pass());
51 } 57 }
52 58
53 void CopyOutputRequest::SendBitmapResult(scoped_ptr<SkBitmap> bitmap) { 59 void CopyOutputRequest::SendBitmapResult(scoped_ptr<SkBitmap> bitmap) {
54 SendResult(CopyOutputResult::CreateBitmapResult(bitmap.Pass()).Pass()); 60 SendResult(CopyOutputResult::CreateBitmapResult(bitmap.Pass()).Pass());
55 } 61 }
56 62
57 void CopyOutputRequest::SendTextureResult( 63 void CopyOutputRequest::SendTextureResult(
58 const gfx::Size& size, 64 const gfx::Size& size,
59 const TextureMailbox& texture_mailbox, 65 const TextureMailbox& texture_mailbox,
60 scoped_ptr<SingleReleaseCallback> release_callback) { 66 scoped_ptr<SingleReleaseCallback> release_callback) {
61 DCHECK(texture_mailbox.IsTexture()); 67 DCHECK(texture_mailbox.IsTexture());
62 SendResult(CopyOutputResult::CreateTextureResult( 68 SendResult(CopyOutputResult::CreateTextureResult(
63 size, texture_mailbox, release_callback.Pass())); 69 size, texture_mailbox, release_callback.Pass()));
64 } 70 }
65 71
66 void CopyOutputRequest::SetTextureMailbox( 72 void CopyOutputRequest::SetTextureMailbox(
67 const TextureMailbox& texture_mailbox) { 73 const TextureMailbox& texture_mailbox) {
68 DCHECK(!force_bitmap_result_); 74 DCHECK(!force_bitmap_result_);
69 DCHECK(texture_mailbox.IsTexture()); 75 DCHECK(texture_mailbox.IsTexture());
70 has_texture_mailbox_ = true; 76 has_texture_mailbox_ = true;
71 texture_mailbox_ = texture_mailbox; 77 texture_mailbox_ = texture_mailbox;
72 } 78 }
73 79
74 } // namespace cc 80 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698