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

Side by Side Diff: cc/throttled_texture_uploader.cc

Issue 11111005: Remove GraphicsContext3D:: stubs from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 8 years, 2 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 | « cc/threaded_unittest.h ('k') | cc/throttled_texture_uploader_unittest.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 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 "config.h" 5 #include "config.h"
6 #include "cc/throttled_texture_uploader.h" 6 #include "cc/throttled_texture_uploader.h"
7 7
8 #include "CCPrioritizedTexture.h" 8 #include "CCPrioritizedTexture.h"
9 #include "Extensions3DChromium.h"
10 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
11 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "third_party/khronos/GLES2/gl2.h"
12 #include "third_party/khronos/GLES2/gl2ext.h"
12 #include <algorithm> 13 #include <algorithm>
13 #include <public/WebGraphicsContext3D.h> 14 #include <public/WebGraphicsContext3D.h>
14 #include <vector> 15 #include <vector>
15 16
16 namespace { 17 namespace {
17 18
18 // How many previous uploads to use when predicting future throughput. 19 // How many previous uploads to use when predicting future throughput.
19 static const size_t uploadHistorySize = 100; 20 static const size_t uploadHistorySize = 100;
20 21
21 // Global estimated number of textures per second to maintain estimates across 22 // Global estimated number of textures per second to maintain estimates across
(...skipping 17 matching lines...) Expand all
39 40
40 ThrottledTextureUploader::Query::~Query() 41 ThrottledTextureUploader::Query::~Query()
41 { 42 {
42 m_context->deleteQueryEXT(m_queryId); 43 m_context->deleteQueryEXT(m_queryId);
43 } 44 }
44 45
45 void ThrottledTextureUploader::Query::begin() 46 void ThrottledTextureUploader::Query::begin()
46 { 47 {
47 m_hasValue = false; 48 m_hasValue = false;
48 m_isNonBlocking = false; 49 m_isNonBlocking = false;
49 m_context->beginQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM, m_q ueryId); 50 m_context->beginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, m_queryId);
50 } 51 }
51 52
52 void ThrottledTextureUploader::Query::end() 53 void ThrottledTextureUploader::Query::end()
53 { 54 {
54 m_context->endQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM); 55 m_context->endQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM);
55 } 56 }
56 57
57 bool ThrottledTextureUploader::Query::isPending() 58 bool ThrottledTextureUploader::Query::isPending()
58 { 59 {
59 unsigned available = 1; 60 unsigned available = 1;
60 m_context->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_RESUL T_AVAILABLE_EXT, &available); 61 m_context->getQueryObjectuivEXT(m_queryId, GL_QUERY_RESULT_AVAILABLE_EXT, &a vailable);
61 return !available; 62 return !available;
62 } 63 }
63 64
64 void ThrottledTextureUploader::Query::wait() 65 void ThrottledTextureUploader::Query::wait()
65 { 66 {
66 value(); 67 value();
67 return; 68 return;
68 } 69 }
69 70
70 unsigned ThrottledTextureUploader::Query::value() 71 unsigned ThrottledTextureUploader::Query::value()
71 { 72 {
72 if (!m_hasValue) { 73 if (!m_hasValue) {
73 m_context->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_R ESULT_EXT, &m_value); 74 m_context->getQueryObjectuivEXT(m_queryId, GL_QUERY_RESULT_EXT, &m_value );
74 m_hasValue = true; 75 m_hasValue = true;
75 } 76 }
76 return m_value; 77 return m_value;
77 } 78 }
78 79
79 void ThrottledTextureUploader::Query::markAsNonBlocking() 80 void ThrottledTextureUploader::Query::markAsNonBlocking()
80 { 81 {
81 m_isNonBlocking = true; 82 m_isNonBlocking = true;
82 } 83 }
83 84
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Remove the oldest values from our history and insert the new one 193 // Remove the oldest values from our history and insert the new one
193 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); 194 double texturesPerSecond = 1.0 / (usElapsed * 1e-6);
194 m_texturesPerSecondHistory.pop_back(); 195 m_texturesPerSecondHistory.pop_back();
195 m_texturesPerSecondHistory.push_front(texturesPerSecond); 196 m_texturesPerSecondHistory.push_front(texturesPerSecond);
196 197
197 m_availableQueries.append(m_pendingQueries.takeFirst()); 198 m_availableQueries.append(m_pendingQueries.takeFirst());
198 } 199 }
199 } 200 }
200 201
201 } 202 }
OLDNEW
« no previous file with comments | « cc/threaded_unittest.h ('k') | cc/throttled_texture_uploader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698