OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/scheduler/texture_uploader.h" | 5 #include "cc/scheduler/texture_uploader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // synchronize access. | 31 // synchronize access. |
32 static const double kDefaultEstimatedTexturesPerSecond = 48.0 * 60.0; | 32 static const double kDefaultEstimatedTexturesPerSecond = 48.0 * 60.0; |
33 | 33 |
34 // Flush interval when performing texture uploads. | 34 // Flush interval when performing texture uploads. |
35 static const size_t kTextureUploadFlushPeriod = 4; | 35 static const size_t kTextureUploadFlushPeriod = 4; |
36 | 36 |
37 } // anonymous namespace | 37 } // anonymous namespace |
38 | 38 |
39 namespace cc { | 39 namespace cc { |
40 | 40 |
41 TextureUploader::Query::Query(WebKit::WebGraphicsContext3D* context) | 41 TextureUploader::Query::Query(blink::WebGraphicsContext3D* context) |
42 : context_(context), | 42 : context_(context), |
43 query_id_(0), | 43 query_id_(0), |
44 value_(0), | 44 value_(0), |
45 has_value_(false), | 45 has_value_(false), |
46 is_non_blocking_(false) { | 46 is_non_blocking_(false) { |
47 query_id_ = context_->createQueryEXT(); | 47 query_id_ = context_->createQueryEXT(); |
48 } | 48 } |
49 | 49 |
50 TextureUploader::Query::~Query() { context_->deleteQueryEXT(query_id_); } | 50 TextureUploader::Query::~Query() { context_->deleteQueryEXT(query_id_); } |
51 | 51 |
(...skipping 15 matching lines...) Expand all Loading... |
67 } | 67 } |
68 | 68 |
69 unsigned TextureUploader::Query::Value() { | 69 unsigned TextureUploader::Query::Value() { |
70 if (!has_value_) { | 70 if (!has_value_) { |
71 context_->getQueryObjectuivEXT(query_id_, GL_QUERY_RESULT_EXT, &value_); | 71 context_->getQueryObjectuivEXT(query_id_, GL_QUERY_RESULT_EXT, &value_); |
72 has_value_ = true; | 72 has_value_ = true; |
73 } | 73 } |
74 return value_; | 74 return value_; |
75 } | 75 } |
76 | 76 |
77 TextureUploader::TextureUploader(WebKit::WebGraphicsContext3D* context, | 77 TextureUploader::TextureUploader(blink::WebGraphicsContext3D* context, |
78 bool use_map_tex_sub_image, | 78 bool use_map_tex_sub_image, |
79 bool use_shallow_flush) | 79 bool use_shallow_flush) |
80 : context_(context), | 80 : context_(context), |
81 num_blocking_texture_uploads_(0), | 81 num_blocking_texture_uploads_(0), |
82 use_map_tex_sub_image_(use_map_tex_sub_image), | 82 use_map_tex_sub_image_(use_map_tex_sub_image), |
83 sub_image_size_(0), | 83 sub_image_size_(0), |
84 use_shallow_flush_(use_shallow_flush), | 84 use_shallow_flush_(use_shallow_flush), |
85 num_texture_uploads_since_last_flush_(0) { | 85 num_texture_uploads_since_last_flush_(0) { |
86 for (size_t i = kUploadHistorySizeInitial; i > 0; i--) | 86 for (size_t i = kUploadHistorySizeInitial; i > 0; i--) |
87 textures_per_second_history_.insert(kDefaultEstimatedTexturesPerSecond); | 87 textures_per_second_history_.insert(kDefaultEstimatedTexturesPerSecond); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 textures_per_second_history_.erase(textures_per_second_history_.begin()); | 332 textures_per_second_history_.erase(textures_per_second_history_.begin()); |
333 textures_per_second_history_.erase(--textures_per_second_history_.end()); | 333 textures_per_second_history_.erase(--textures_per_second_history_.end()); |
334 } | 334 } |
335 textures_per_second_history_.insert(textures_per_second); | 335 textures_per_second_history_.insert(textures_per_second); |
336 | 336 |
337 available_queries_.push_back(pending_queries_.take_front()); | 337 available_queries_.push_back(pending_queries_.take_front()); |
338 } | 338 } |
339 } | 339 } |
340 | 340 |
341 } // namespace cc | 341 } // namespace cc |
OLD | NEW |