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

Side by Side Diff: cc/resources/scoped_release_callback.cc

Issue 23648014: cc: Move TextureMailbox::ReleaseCallback to SingleReleaseCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: releasecallback: dchecks Created 7 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/resources/scoped_release_callback.h"
6
7 #include "base/callback_helpers.h"
8 #include "base/logging.h"
9
10 namespace cc {
11
12 ScopedReleaseCallback::ScopedReleaseCallback(const ReleaseCallback& callback)
13 : has_been_run_(false), callback_(callback) {
14 DCHECK(!callback_.is_null())
15 << "Use a NULL ScopedReleaseCallback for an empty callback.";
16 }
17
18 ScopedReleaseCallback::~ScopedReleaseCallback() {
19 DCHECK(callback_.is_null() || has_been_run_)
20 << "ScopedReleaseCallback was never run.";
21 }
22
23 void ScopedReleaseCallback::Run(unsigned sync_point, bool is_lost) {
24 DCHECK(!has_been_run_) << "ScopedReleaseCallback was run more than once.";
25 has_been_run_ = true;
26 callback_.Run(sync_point, is_lost);
27 }
28
29 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698