OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/test/test_web_graphics_context_3d.h" | 5 #include "cc/test/test_web_graphics_context_3d.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 void TestWebGraphicsContext3D::getQueryObjectuivEXT( | 289 void TestWebGraphicsContext3D::getQueryObjectuivEXT( |
290 WebGLId query, | 290 WebGLId query, |
291 WGC3Denum pname, | 291 WGC3Denum pname, |
292 WGC3Duint* params) { | 292 WGC3Duint* params) { |
293 // If the context is lost, behave as if result is available. | 293 // If the context is lost, behave as if result is available. |
294 if (pname == GL_QUERY_RESULT_AVAILABLE_EXT) | 294 if (pname == GL_QUERY_RESULT_AVAILABLE_EXT) |
295 *params = 1; | 295 *params = 1; |
296 } | 296 } |
297 | 297 |
| 298 |
| 299 void TestWebGraphicsContext3D::genMailboxCHROMIUM(WebKit::WGC3Dbyte* mailbox) { |
| 300 static char mailbox_name1 = '1'; |
| 301 static char mailbox_name2 = '1'; |
| 302 mailbox[0] = mailbox_name1; |
| 303 mailbox[1] = mailbox_name2; |
| 304 mailbox[2] = '\0'; |
| 305 if (++mailbox_name1 == 0) { |
| 306 mailbox_name1 = '1'; |
| 307 ++mailbox_name2; |
| 308 } |
| 309 } |
| 310 |
298 void TestWebGraphicsContext3D::setContextLostCallback( | 311 void TestWebGraphicsContext3D::setContextLostCallback( |
299 WebGraphicsContextLostCallback* callback) { | 312 WebGraphicsContextLostCallback* callback) { |
300 context_lost_callback_ = callback; | 313 context_lost_callback_ = callback; |
301 } | 314 } |
302 | 315 |
303 void TestWebGraphicsContext3D::loseContextCHROMIUM(WGC3Denum current, | 316 void TestWebGraphicsContext3D::loseContextCHROMIUM(WGC3Denum current, |
304 WGC3Denum other) { | 317 WGC3Denum other) { |
305 if (context_lost_) | 318 if (context_lost_) |
306 return; | 319 return; |
307 context_lost_ = true; | 320 context_lost_ = true; |
308 if (context_lost_callback_) | 321 if (context_lost_callback_) |
309 context_lost_callback_->onContextLost(); | 322 context_lost_callback_->onContextLost(); |
310 | 323 |
311 for (size_t i = 0; i < shared_contexts_.size(); ++i) | 324 for (size_t i = 0; i < shared_contexts_.size(); ++i) |
312 shared_contexts_[i]->loseContextCHROMIUM(current, other); | 325 shared_contexts_[i]->loseContextCHROMIUM(current, other); |
313 shared_contexts_.clear(); | 326 shared_contexts_.clear(); |
314 } | 327 } |
315 | 328 |
316 WebGLId TestWebGraphicsContext3D::NextTextureId() { | 329 WebGLId TestWebGraphicsContext3D::NextTextureId() { |
317 WebGLId texture_id = next_texture_id_++; | 330 WebGLId texture_id = next_texture_id_++; |
318 DCHECK(texture_id < (1 << 16)); | 331 DCHECK(texture_id < (1 << 16)); |
319 texture_id |= context_id_ << 16; | 332 texture_id |= context_id_ << 16; |
320 return texture_id; | 333 return texture_id; |
321 } | 334 } |
322 | 335 |
323 } // namespace cc | 336 } // namespace cc |
OLD | NEW |