Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: gpu/command_buffer/client/cmd_buffer_helper.h

Issue 381473004: Use TimeTicks instead of clock() in gpu::CommandBufferHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/command_buffer/client/cmd_buffer_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file contains the command buffer helper class. 5 // This file contains the command buffer helper class.
6 6
7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
9 9
10 #include <string.h> 10 #include <string.h>
11 #include <time.h> 11 #include <time.h>
12 12
13 #include "base/time/time.h"
13 #include "gpu/command_buffer/common/cmd_buffer_common.h" 14 #include "gpu/command_buffer/common/cmd_buffer_common.h"
14 #include "gpu/command_buffer/common/command_buffer.h" 15 #include "gpu/command_buffer/common/command_buffer.h"
15 #include "gpu/command_buffer/common/constants.h" 16 #include "gpu/command_buffer/common/constants.h"
16 #include "gpu/gpu_export.h" 17 #include "gpu/gpu_export.h"
17 18
18 namespace gpu { 19 namespace gpu {
19 20
20 #if !defined(OS_ANDROID) 21 #if !defined(OS_ANDROID)
21 #define CMD_HELPER_PERIODIC_FLUSH_CHECK 22 #define CMD_HELPER_PERIODIC_FLUSH_CHECK
22 const int kCommandsPerFlushCheck = 100; 23 const int kCommandsPerFlushCheck = 100;
23 const float kPeriodicFlushDelay = 1.0f / (5.0f * 60.0f); 24 const int kPeriodicFlushDelayInMicroseconds =
25 base::Time::kMicrosecondsPerSecond / (5 * 60);
24 #endif 26 #endif
25 27
26 const int kAutoFlushSmall = 16; // 1/16 of the buffer 28 const int kAutoFlushSmall = 16; // 1/16 of the buffer
27 const int kAutoFlushBig = 2; // 1/2 of the buffer 29 const int kAutoFlushBig = 2; // 1/2 of the buffer
28 30
29 // Command buffer helper class. This class simplifies ring buffer management: 31 // Command buffer helper class. This class simplifies ring buffer management:
30 // it will allocate the buffer, give it to the buffer interface, and let the 32 // it will allocate the buffer, give it to the buffer interface, and let the
31 // user add commands to it, while taking care of the synchronization (put and 33 // user add commands to it, while taking care of the synchronization (put and
32 // get). It also provides a way to ensure commands have been executed, through 34 // get). It also provides a way to ensure commands have been executed, through
33 // the token mechanism: 35 // the token mechanism:
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 int32 last_put_sent_; 320 int32 last_put_sent_;
319 321
320 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) 322 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK)
321 int commands_issued_; 323 int commands_issued_;
322 #endif 324 #endif
323 325
324 bool usable_; 326 bool usable_;
325 bool context_lost_; 327 bool context_lost_;
326 bool flush_automatically_; 328 bool flush_automatically_;
327 329
328 // Using C runtime instead of base because this file cannot depend on base. 330 base::TimeTicks last_flush_time_;
329 clock_t last_flush_time_;
330 331
331 // Incremented every time the helper flushes the command buffer. 332 // Incremented every time the helper flushes the command buffer.
332 // Can be used to track when prior commands have been flushed. 333 // Can be used to track when prior commands have been flushed.
333 uint32 flush_generation_; 334 uint32 flush_generation_;
334 335
335 friend class CommandBufferHelperTest; 336 friend class CommandBufferHelperTest;
336 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); 337 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper);
337 }; 338 };
338 339
339 } // namespace gpu 340 } // namespace gpu
340 341
341 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 342 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/cmd_buffer_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698