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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 context_->bindFramebuffer(GL_FRAMEBUFFER, framebuffer_); | 306 context_->bindFramebuffer(GL_FRAMEBUFFER, framebuffer_); |
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 gpu::SyncToken sync_token; |
317 texture_mailbox_ = cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); | 317 context_->insertSyncPoint(sync_token.GetData()); |
| 318 texture_mailbox_ = cc::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D); |
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(const gpu::SyncToken& sync_token, bool lost) { |
345 } | 346 } |
346 | 347 |
347 static void ReleaseSharedMemory(scoped_ptr<cc::SharedBitmap> bitmap, | 348 static void ReleaseSharedMemory(scoped_ptr<cc::SharedBitmap> bitmap, |
348 uint32 sync_point, | 349 const gpu::SyncToken& sync_token, |
349 bool lost) { | 350 bool lost) {} |
350 } | |
351 | 351 |
352 bool TestPlugin::PrepareTextureMailbox( | 352 bool TestPlugin::PrepareTextureMailbox( |
353 cc::TextureMailbox* mailbox, | 353 cc::TextureMailbox* mailbox, |
354 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 354 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
355 bool use_shared_memory) { | 355 bool use_shared_memory) { |
356 if (!mailbox_changed_) | 356 if (!mailbox_changed_) |
357 return false; | 357 return false; |
358 *mailbox = texture_mailbox_; | 358 *mailbox = texture_mailbox_; |
359 if (texture_mailbox_.IsTexture()) { | 359 if (texture_mailbox_.IsTexture()) { |
360 *release_callback = | 360 *release_callback = |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 return kPluginPersistsMimeType; | 779 return kPluginPersistsMimeType; |
780 } | 780 } |
781 | 781 |
782 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { | 782 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { |
783 return mime_type == TestPlugin::MimeType() || | 783 return mime_type == TestPlugin::MimeType() || |
784 mime_type == PluginPersistsMimeType() || | 784 mime_type == PluginPersistsMimeType() || |
785 mime_type == CanCreateWithoutRendererMimeType(); | 785 mime_type == CanCreateWithoutRendererMimeType(); |
786 } | 786 } |
787 | 787 |
788 } // namespace test_runner | 788 } // namespace test_runner |
OLD | NEW |