OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/renderer/npapi/webplugin_delegate_proxy.h" | 5 #include "content/renderer/npapi/webplugin_delegate_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 | 536 |
537 #if defined(OS_POSIX) | 537 #if defined(OS_POSIX) |
538 // If we're using POSIX mmap'd TransportDIBs, sending the handle across | 538 // If we're using POSIX mmap'd TransportDIBs, sending the handle across |
539 // IPC establishes a new mapping rather than just sending a window ID, | 539 // IPC establishes a new mapping rather than just sending a window ID, |
540 // so only do so if we've actually changed the shared memory bitmaps. | 540 // so only do so if we've actually changed the shared memory bitmaps. |
541 if (bitmaps_changed) | 541 if (bitmaps_changed) |
542 #endif | 542 #endif |
543 { | 543 { |
544 if (transport_stores_[0].bitmap) | 544 if (transport_stores_[0].bitmap) |
545 CopySharedMemoryHandleForMessage( | 545 CopySharedMemoryHandleForMessage( |
546 transport_stores_[0].bitmap->memory()->handle(), | 546 transport_stores_[0].bitmap->shared_memory()->handle(), |
547 ¶m.windowless_buffer0, channel_host_->peer_pid()); | 547 ¶m.windowless_buffer0, channel_host_->peer_pid()); |
548 | 548 |
549 if (transport_stores_[1].bitmap) | 549 if (transport_stores_[1].bitmap) |
550 CopySharedMemoryHandleForMessage( | 550 CopySharedMemoryHandleForMessage( |
551 transport_stores_[1].bitmap->memory()->handle(), | 551 transport_stores_[1].bitmap->shared_memory()->handle(), |
552 ¶m.windowless_buffer1, channel_host_->peer_pid()); | 552 ¶m.windowless_buffer1, channel_host_->peer_pid()); |
553 } | 553 } |
554 | 554 |
555 IPC::Message* msg; | 555 IPC::Message* msg; |
556 #if defined(OS_WIN) | 556 #if defined(OS_WIN) |
557 if (UseSynchronousGeometryUpdates()) { | 557 if (UseSynchronousGeometryUpdates()) { |
558 msg = new PluginMsg_UpdateGeometrySync(instance_id_, param); | 558 msg = new PluginMsg_UpdateGeometrySync(instance_id_, param); |
559 } else // NOLINT | 559 } else // NOLINT |
560 #endif | 560 #endif |
561 { | 561 { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 if (memory->size() != size) | 635 if (memory->size() != size) |
636 return false; | 636 return false; |
637 canvas->reset(skia::CreatePlatformCanvas( | 637 canvas->reset(skia::CreatePlatformCanvas( |
638 plugin_rect_.width(), plugin_rect_.height(), true, &((*memory)[0]), | 638 plugin_rect_.width(), plugin_rect_.height(), true, &((*memory)[0]), |
639 skia::CRASH_ON_FAILURE)); | 639 skia::CRASH_ON_FAILURE)); |
640 return true; | 640 return true; |
641 } | 641 } |
642 #endif | 642 #endif |
643 | 643 |
644 bool WebPluginDelegateProxy::CreateSharedBitmap( | 644 bool WebPluginDelegateProxy::CreateSharedBitmap( |
645 scoped_ptr<cc::SharedBitmap>* memory, | 645 scoped_ptr<SharedMemoryBitmap>* memory, |
646 scoped_ptr<skia::PlatformCanvas>* canvas) { | 646 scoped_ptr<skia::PlatformCanvas>* canvas) { |
647 *memory = | 647 *memory = ChildThread::current() |
648 ChildThread::current()->shared_bitmap_manager()->AllocateSharedBitmap( | 648 ->shared_bitmap_manager() |
649 plugin_rect_.size()); | 649 ->AllocateSharedMemoryBitmap(plugin_rect_.size()); |
650 if (!memory->get()) | 650 if (!memory->get()) |
651 return false; | 651 return false; |
652 DCHECK((*memory)->memory()); | 652 DCHECK((*memory)->shared_memory()); |
653 #if defined(OS_POSIX) | 653 #if defined(OS_POSIX) |
654 canvas->reset(skia::CreatePlatformCanvas( | 654 canvas->reset(skia::CreatePlatformCanvas( |
655 plugin_rect_.width(), plugin_rect_.height(), true, (*memory)->pixels(), | 655 plugin_rect_.width(), plugin_rect_.height(), true, (*memory)->pixels(), |
656 skia::RETURN_NULL_ON_FAILURE)); | 656 skia::RETURN_NULL_ON_FAILURE)); |
657 #else | 657 #else |
658 canvas->reset(skia::CreatePlatformCanvas( | 658 canvas->reset(skia::CreatePlatformCanvas( |
659 plugin_rect_.width(), plugin_rect_.height(), true, | 659 plugin_rect_.width(), plugin_rect_.height(), true, |
660 (*memory)->memory()->handle(), skia::RETURN_NULL_ON_FAILURE)); | 660 (*memory)->shared_memory()->handle(), skia::RETURN_NULL_ON_FAILURE)); |
661 #endif | 661 #endif |
662 return !!canvas->get(); | 662 return !!canvas->get(); |
663 } | 663 } |
664 | 664 |
665 void WebPluginDelegateProxy::Paint(SkCanvas* canvas, | 665 void WebPluginDelegateProxy::Paint(SkCanvas* canvas, |
666 const gfx::Rect& damaged_rect) { | 666 const gfx::Rect& damaged_rect) { |
667 // Limit the damaged rectangle to whatever is contained inside the plugin | 667 // Limit the damaged rectangle to whatever is contained inside the plugin |
668 // rectangle, as that's the rectangle that we'll actually draw. | 668 // rectangle, as that's the rectangle that we'll actually draw. |
669 gfx::Rect rect = gfx::IntersectRects(damaged_rect, plugin_rect_); | 669 gfx::Rect rect = gfx::IntersectRects(damaged_rect, plugin_rect_); |
670 | 670 |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 | 1240 |
1241 plugin_->URLRedirectResponse(allow, resource_id); | 1241 plugin_->URLRedirectResponse(allow, resource_id); |
1242 } | 1242 } |
1243 | 1243 |
1244 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, | 1244 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, |
1245 bool* result) { | 1245 bool* result) { |
1246 *result = plugin_->CheckIfRunInsecureContent(url); | 1246 *result = plugin_->CheckIfRunInsecureContent(url); |
1247 } | 1247 } |
1248 | 1248 |
1249 } // namespace content | 1249 } // namespace content |
OLD | NEW |