• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
7 namespace gpu {
8 
AsyncMemoryParams(scoped_refptr<Buffer> buffer,uint32 data_offset,uint32 data_size)9 AsyncMemoryParams::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 
~AsyncMemoryParams()17 AsyncMemoryParams::~AsyncMemoryParams() {
18 }
19 
AsyncPixelTransferUploadStats()20 AsyncPixelTransferUploadStats::AsyncPixelTransferUploadStats()
21     : texture_upload_count_(0) {}
22 
~AsyncPixelTransferUploadStats()23 AsyncPixelTransferUploadStats::~AsyncPixelTransferUploadStats() {}
24 
AddUpload(base::TimeDelta transfer_time)25 void 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 
GetStats(base::TimeDelta * total_texture_upload_time)31 int 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 
AsyncPixelTransferDelegate()39 AsyncPixelTransferDelegate::AsyncPixelTransferDelegate() {}
40 
~AsyncPixelTransferDelegate()41 AsyncPixelTransferDelegate::~AsyncPixelTransferDelegate() {}
42 
43 }  // namespace gpu
44