| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/test_runner/test_plugin.h" | 5 #include "components/test_runner/test_plugin.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 context_->framebufferTexture2D( | 307 context_->framebufferTexture2D( |
| 308 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_, 0); | 308 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_, 0); |
| 309 | 309 |
| 310 DrawSceneGL(); | 310 DrawSceneGL(); |
| 311 | 311 |
| 312 gpu::Mailbox mailbox; | 312 gpu::Mailbox mailbox; |
| 313 context_->genMailboxCHROMIUM(mailbox.name); | 313 context_->genMailboxCHROMIUM(mailbox.name); |
| 314 context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 314 context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 315 context_->flush(); | 315 context_->flush(); |
| 316 uint32 sync_point = context_->insertSyncPoint(); | 316 uint32 sync_point = context_->insertSyncPoint(); |
| 317 texture_mailbox_ = cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); | 317 texture_mailbox_ = cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point, |
| 318 gpu::SyncToken()); |
| 318 } else { | 319 } else { |
| 319 scoped_ptr<cc::SharedBitmap> bitmap = | 320 scoped_ptr<cc::SharedBitmap> bitmap = |
| 320 delegate_->GetSharedBitmapManager()->AllocateSharedBitmap( | 321 delegate_->GetSharedBitmapManager()->AllocateSharedBitmap( |
| 321 gfx::Rect(rect_).size()); | 322 gfx::Rect(rect_).size()); |
| 322 if (!bitmap) { | 323 if (!bitmap) { |
| 323 texture_mailbox_ = cc::TextureMailbox(); | 324 texture_mailbox_ = cc::TextureMailbox(); |
| 324 } else { | 325 } else { |
| 325 DrawSceneSoftware(bitmap->pixels()); | 326 DrawSceneSoftware(bitmap->pixels()); |
| 326 texture_mailbox_ = cc::TextureMailbox( | 327 texture_mailbox_ = cc::TextureMailbox( |
| 327 bitmap.get(), gfx::Size(rect_.width, rect_.height)); | 328 bitmap.get(), gfx::Size(rect_.width, rect_.height)); |
| 328 shared_bitmap_ = bitmap.Pass(); | 329 shared_bitmap_ = bitmap.Pass(); |
| 329 } | 330 } |
| 330 } | 331 } |
| 331 | 332 |
| 332 mailbox_changed_ = true; | 333 mailbox_changed_ = true; |
| 333 layer_->SetNeedsDisplay(); | 334 layer_->SetNeedsDisplay(); |
| 334 } | 335 } |
| 335 | 336 |
| 336 bool TestPlugin::acceptsInputEvents() { | 337 bool TestPlugin::acceptsInputEvents() { |
| 337 return true; | 338 return true; |
| 338 } | 339 } |
| 339 | 340 |
| 340 bool TestPlugin::isPlaceholder() { | 341 bool TestPlugin::isPlaceholder() { |
| 341 return false; | 342 return false; |
| 342 } | 343 } |
| 343 | 344 |
| 344 static void IgnoreReleaseCallback(uint32 sync_point, bool lost) { | 345 static void IgnoreReleaseCallback(uint32 sync_point, |
| 345 } | 346 const gpu::SyncToken& sync_token, |
| 347 bool lost) {} |
| 346 | 348 |
| 347 static void ReleaseSharedMemory(scoped_ptr<cc::SharedBitmap> bitmap, | 349 static void ReleaseSharedMemory(scoped_ptr<cc::SharedBitmap> bitmap, |
| 348 uint32 sync_point, | 350 uint32 sync_point, |
| 349 bool lost) { | 351 const gpu::SyncToken& sync_token, |
| 350 } | 352 bool lost) {} |
| 351 | 353 |
| 352 bool TestPlugin::PrepareTextureMailbox( | 354 bool TestPlugin::PrepareTextureMailbox( |
| 353 cc::TextureMailbox* mailbox, | 355 cc::TextureMailbox* mailbox, |
| 354 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 356 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
| 355 bool use_shared_memory) { | 357 bool use_shared_memory) { |
| 356 if (!mailbox_changed_) | 358 if (!mailbox_changed_) |
| 357 return false; | 359 return false; |
| 358 *mailbox = texture_mailbox_; | 360 *mailbox = texture_mailbox_; |
| 359 if (texture_mailbox_.IsTexture()) { | 361 if (texture_mailbox_.IsTexture()) { |
| 360 *release_callback = | 362 *release_callback = |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 return kPluginPersistsMimeType; | 781 return kPluginPersistsMimeType; |
| 780 } | 782 } |
| 781 | 783 |
| 782 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { | 784 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { |
| 783 return mime_type == TestPlugin::MimeType() || | 785 return mime_type == TestPlugin::MimeType() || |
| 784 mime_type == PluginPersistsMimeType() || | 786 mime_type == PluginPersistsMimeType() || |
| 785 mime_type == CanCreateWithoutRendererMimeType(); | 787 mime_type == CanCreateWithoutRendererMimeType(); |
| 786 } | 788 } |
| 787 | 789 |
| 788 } // namespace test_runner | 790 } // namespace test_runner |
| OLD | NEW |