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.
5 #include "cc/resources/single_release_callback.h"
7 #include "base/callback_helpers.h"
8 #include "base/logging.h"
12 SingleReleaseCallback::SingleReleaseCallback(const ReleaseCallback& callback)
13 : has_been_run_(false), callback_(callback) {
14 DCHECK(!callback_.is_null())
15 << "Use a NULL SingleReleaseCallback for an empty callback.";
18 SingleReleaseCallback::~SingleReleaseCallback() {
19 DCHECK(callback_.is_null() || has_been_run_)
20 << "SingleReleaseCallback was never run.";
23 void SingleReleaseCallback::Run(unsigned sync_point, bool is_lost) {
24 DCHECK(!has_been_run_) << "SingleReleaseCallback was run more than once.";
26 callback_.Run(sync_point, is_lost);