1// Copyright (c) 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 "gpu/command_buffer/service/async_pixel_transfer_delegate.h"
6
7namespace gpu {
8
9AsyncMemoryParams::AsyncMemoryParams(scoped_refptr<Buffer> buffer,
10                    uint32 data_offset,
11                    uint32 data_size)
12    : buffer_(buffer), data_offset_(data_offset), data_size_(data_size) {
13  DCHECK(buffer_.get());
14  DCHECK(buffer_->memory());
15}
16
17AsyncMemoryParams::~AsyncMemoryParams() {
18}
19
20AsyncPixelTransferUploadStats::AsyncPixelTransferUploadStats()
21    : texture_upload_count_(0) {}
22
23AsyncPixelTransferUploadStats::~AsyncPixelTransferUploadStats() {}
24
25void AsyncPixelTransferUploadStats::AddUpload(base::TimeDelta transfer_time) {
26  base::AutoLock scoped_lock(lock_);
27  texture_upload_count_++;
28  total_texture_upload_time_ += transfer_time;
29}
30
31int AsyncPixelTransferUploadStats::GetStats(
32    base::TimeDelta* total_texture_upload_time) {
33  base::AutoLock scoped_lock(lock_);
34  if (total_texture_upload_time)
35    *total_texture_upload_time = total_texture_upload_time_;
36  return texture_upload_count_;
37}
38
39AsyncPixelTransferDelegate::AsyncPixelTransferDelegate() {}
40
41AsyncPixelTransferDelegate::~AsyncPixelTransferDelegate() {}
42
43}  // namespace gpu
44