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

Side by Side Diff: cc/resources/resource_provider_unittest.cc

Issue 1539203002: Switch to standard integer types in cc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more includes Created 5 years 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
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/resource_util.h » ('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 "cc/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include <algorithm> 10 #include <algorithm>
8 #include <deque> 11 #include <deque>
9 #include <map> 12 #include <map>
10 #include <set> 13 #include <set>
11 #include <vector> 14 #include <vector>
12 15
13 #include "base/bind.h" 16 #include "base/bind.h"
14 #include "base/containers/hash_tables.h" 17 #include "base/containers/hash_tables.h"
15 #include "base/logging.h" 18 #include "base/logging.h"
16 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 }; 120 };
118 121
119 // Shared data between multiple ResourceProviderContext. This contains mailbox 122 // Shared data between multiple ResourceProviderContext. This contains mailbox
120 // contents as well as information about sync points. 123 // contents as well as information about sync points.
121 class ContextSharedData { 124 class ContextSharedData {
122 public: 125 public:
123 static scoped_ptr<ContextSharedData> Create() { 126 static scoped_ptr<ContextSharedData> Create() {
124 return make_scoped_ptr(new ContextSharedData()); 127 return make_scoped_ptr(new ContextSharedData());
125 } 128 }
126 129
127 uint32 InsertSyncPoint() { return next_sync_point_++; } 130 uint32_t InsertSyncPoint() { return next_sync_point_++; }
128 131
129 void GenMailbox(GLbyte* mailbox) { 132 void GenMailbox(GLbyte* mailbox) {
130 memset(mailbox, 0, GL_MAILBOX_SIZE_CHROMIUM); 133 memset(mailbox, 0, GL_MAILBOX_SIZE_CHROMIUM);
131 memcpy(mailbox, &next_mailbox_, sizeof(next_mailbox_)); 134 memcpy(mailbox, &next_mailbox_, sizeof(next_mailbox_));
132 ++next_mailbox_; 135 ++next_mailbox_;
133 } 136 }
134 137
135 void ProduceTexture(const GLbyte* mailbox_name, 138 void ProduceTexture(const GLbyte* mailbox_name,
136 const gpu::SyncToken& sync_token, 139 const gpu::SyncToken& sync_token,
137 scoped_refptr<TestTexture> texture) { 140 scoped_refptr<TestTexture> texture) {
(...skipping 19 matching lines...) Expand all
157 if (sync_point_for_mailbox_[mailbox] > sync_token.release_count()) { 160 if (sync_point_for_mailbox_[mailbox] > sync_token.release_count()) {
158 NOTREACHED(); 161 NOTREACHED();
159 return scoped_refptr<TestTexture>(); 162 return scoped_refptr<TestTexture>();
160 } 163 }
161 return textures_[mailbox]; 164 return textures_[mailbox];
162 } 165 }
163 166
164 private: 167 private:
165 ContextSharedData() : next_sync_point_(1), next_mailbox_(1) {} 168 ContextSharedData() : next_sync_point_(1), next_mailbox_(1) {}
166 169
167 uint32 next_sync_point_; 170 uint32_t next_sync_point_;
168 unsigned next_mailbox_; 171 unsigned next_mailbox_;
169 typedef base::hash_map<unsigned, scoped_refptr<TestTexture>> TextureMap; 172 typedef base::hash_map<unsigned, scoped_refptr<TestTexture>> TextureMap;
170 TextureMap textures_; 173 TextureMap textures_;
171 base::hash_map<unsigned, uint32> sync_point_for_mailbox_; 174 base::hash_map<unsigned, uint32_t> sync_point_for_mailbox_;
172 }; 175 };
173 176
174 class ResourceProviderContext : public TestWebGraphicsContext3D { 177 class ResourceProviderContext : public TestWebGraphicsContext3D {
175 public: 178 public:
176 static scoped_ptr<ResourceProviderContext> Create( 179 static scoped_ptr<ResourceProviderContext> Create(
177 ContextSharedData* shared_data) { 180 ContextSharedData* shared_data) {
178 return make_scoped_ptr(new ResourceProviderContext(shared_data)); 181 return make_scoped_ptr(new ResourceProviderContext(shared_data));
179 } 182 }
180 183
181 GLuint insertSyncPoint() override { 184 GLuint insertSyncPoint() override {
182 uint32 sync_point = shared_data_->InsertSyncPoint(); 185 uint32_t sync_point = shared_data_->InsertSyncPoint();
183 // Commit the produceTextureCHROMIUM calls at this point, so that 186 // Commit the produceTextureCHROMIUM calls at this point, so that
184 // they're associated with the sync point. 187 // they're associated with the sync point.
185 for (const scoped_ptr<PendingProduceTexture>& pending_texture : 188 for (const scoped_ptr<PendingProduceTexture>& pending_texture :
186 pending_produce_textures_) { 189 pending_produce_textures_) {
187 shared_data_->ProduceTexture(pending_texture->mailbox, 190 shared_data_->ProduceTexture(pending_texture->mailbox,
188 gpu::SyncToken(sync_point), 191 gpu::SyncToken(sync_point),
189 pending_texture->texture); 192 pending_texture->texture);
190 } 193 }
191 pending_produce_textures_.clear(); 194 pending_produce_textures_.clear();
192 return sync_point; 195 return sync_point;
(...skipping 3362 matching lines...) Expand 10 before | Expand all | Expand 10 after
3555 resource_provider->AllocateForTesting(id); 3558 resource_provider->AllocateForTesting(id);
3556 Mock::VerifyAndClearExpectations(context); 3559 Mock::VerifyAndClearExpectations(context);
3557 3560
3558 DCHECK_EQ(10u, context->PeekTextureId()); 3561 DCHECK_EQ(10u, context->PeekTextureId());
3559 resource_provider->DeleteResource(id); 3562 resource_provider->DeleteResource(id);
3560 } 3563 }
3561 } 3564 }
3562 3565
3563 } // namespace 3566 } // namespace
3564 } // namespace cc 3567 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/resource_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698