summaryrefslogtreecommitdiff
path: root/chromium/cc/resources/single_release_callback.cc
blob: ff9422302bdb1683cc12d2d7379cf8b405cb3a60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/resources/single_release_callback.h"

#include "base/callback_helpers.h"
#include "base/logging.h"

namespace cc {

SingleReleaseCallback::SingleReleaseCallback(const ReleaseCallback& callback)
    : callback_(callback) {
  DCHECK(!callback_.is_null())
      << "Use a NULL SingleReleaseCallback for an empty callback.";
}

SingleReleaseCallback::~SingleReleaseCallback() {
  DCHECK(callback_.is_null()) << "SingleReleaseCallback was never run.";
}

void SingleReleaseCallback::Run(uint32 sync_point, bool is_lost) {
  DCHECK(!callback_.is_null())
      << "SingleReleaseCallback was run more than once.";
  base::ResetAndReturn(&callback_).Run(sync_point, is_lost);
}

}  // namespace cc