OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gl/async_pixel_transfer_delegate_stub.h" | 5 #include "ui/gl/async_pixel_transfer_delegate_stub.h" |
6 | 6 |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "ui/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 void AsyncTransferStateStub::BindTransfer(AsyncTexImage2DParams* out_params) { | 58 void AsyncTransferStateStub::BindTransfer(AsyncTexImage2DParams* out_params) { |
59 DCHECK(out_params); | 59 DCHECK(out_params); |
60 DCHECK(needs_late_bind_); | 60 DCHECK(needs_late_bind_); |
61 *out_params = late_bind_define_params_; | 61 *out_params = late_bind_define_params_; |
62 needs_late_bind_ = false; | 62 needs_late_bind_ = false; |
63 } | 63 } |
64 | 64 |
65 AsyncPixelTransferDelegateStub::AsyncPixelTransferDelegateStub() { | 65 AsyncPixelTransferDelegateStub::AsyncPixelTransferDelegateStub() |
| 66 : texture_upload_count_(0) { |
66 } | 67 } |
67 | 68 |
68 AsyncPixelTransferDelegateStub::~AsyncPixelTransferDelegateStub() { | 69 AsyncPixelTransferDelegateStub::~AsyncPixelTransferDelegateStub() { |
69 } | 70 } |
70 | 71 |
71 AsyncPixelTransferState* | 72 AsyncPixelTransferState* |
72 AsyncPixelTransferDelegateStub::CreateRawPixelTransferState( | 73 AsyncPixelTransferDelegateStub::CreateRawPixelTransferState( |
73 GLuint texture_id) { | 74 GLuint texture_id) { |
74 return static_cast<AsyncPixelTransferState*>( | 75 return static_cast<AsyncPixelTransferState*>( |
75 new AsyncTransferStateStub(texture_id)); | 76 new AsyncTransferStateStub(texture_id)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 const AsyncTexSubImage2DParams& tex_params, | 116 const AsyncTexSubImage2DParams& tex_params, |
116 const AsyncMemoryParams& mem_params) { | 117 const AsyncMemoryParams& mem_params) { |
117 void* data = GetAddress(mem_params.shared_memory, | 118 void* data = GetAddress(mem_params.shared_memory, |
118 mem_params.shm_size, | 119 mem_params.shm_size, |
119 mem_params.shm_data_offset, | 120 mem_params.shm_data_offset, |
120 mem_params.shm_data_size); | 121 mem_params.shm_data_size); |
121 DCHECK(transfer_state); | 122 DCHECK(transfer_state); |
122 AsyncTransferStateStub* state = | 123 AsyncTransferStateStub* state = |
123 static_cast<AsyncTransferStateStub*>(transfer_state); | 124 static_cast<AsyncTransferStateStub*>(transfer_state); |
124 DCHECK(!state->needs_late_bind_); | 125 DCHECK(!state->needs_late_bind_); |
| 126 base::TimeTicks begin_time(base::TimeTicks::HighResNow()); |
125 glTexSubImage2D( | 127 glTexSubImage2D( |
126 tex_params.target, | 128 tex_params.target, |
127 tex_params.level, | 129 tex_params.level, |
128 tex_params.xoffset, | 130 tex_params.xoffset, |
129 tex_params.yoffset, | 131 tex_params.yoffset, |
130 tex_params.width, | 132 tex_params.width, |
131 tex_params.height, | 133 tex_params.height, |
132 tex_params.format, | 134 tex_params.format, |
133 tex_params.type, | 135 tex_params.type, |
134 data); | 136 data); |
| 137 texture_upload_count_++; |
| 138 total_texture_upload_time_ += base::TimeTicks::HighResNow() - begin_time; |
135 } | 139 } |
| 140 |
| 141 uint32 AsyncPixelTransferDelegateStub::GetTextureUploadCount() { |
| 142 return texture_upload_count_; |
| 143 } |
| 144 |
| 145 base::TimeDelta AsyncPixelTransferDelegateStub::GetTotalTextureUploadTime() { |
| 146 return total_texture_upload_time_; |
| 147 } |
| 148 |
136 } // namespace gfx | 149 } // namespace gfx |
137 | 150 |
OLD | NEW |