| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/plugin/webplugin_proxy.h" | 5 #include "chrome/plugin/webplugin_proxy.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 if (delegate_->IsWindowless() && !clip_rect.IsEmpty() && | 448 if (delegate_->IsWindowless() && !clip_rect.IsEmpty() && |
| 449 old_clip_rect.IsEmpty() && !damaged_rect_.IsEmpty()) { | 449 old_clip_rect.IsEmpty() && !damaged_rect_.IsEmpty()) { |
| 450 InvalidateRect(damaged_rect_); | 450 InvalidateRect(damaged_rect_); |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 | 453 |
| 454 #if defined(OS_WIN) | 454 #if defined(OS_WIN) |
| 455 void WebPluginProxy::SetWindowlessBuffer( | 455 void WebPluginProxy::SetWindowlessBuffer( |
| 456 const TransportDIB::Handle& windowless_buffer, | 456 const TransportDIB::Handle& windowless_buffer, |
| 457 const TransportDIB::Handle& background_buffer) { | 457 const TransportDIB::Handle& background_buffer) { |
| 458 // Create a canvas that will reference the shared bits. | 458 // Create a canvas that will reference the shared bits. We have to handle |
| 459 windowless_canvas_.reset(new skia::PlatformCanvas( | 459 // errors here since we're mapping a large amount of memory that may not fit |
| 460 delegate_->GetRect().width(), | 460 // in our address space, or go wrong in some other way. |
| 461 delegate_->GetRect().height(), | 461 windowless_canvas_.reset(new skia::PlatformCanvas); |
| 462 true, | 462 if (!windowless_canvas_->initialize( |
| 463 win_util::GetSectionFromProcess(windowless_buffer, | 463 delegate_->GetRect().width(), |
| 464 channel_->renderer_handle(), false))); | 464 delegate_->GetRect().height(), |
| 465 true, |
| 466 win_util::GetSectionFromProcess(windowless_buffer, |
| 467 channel_->renderer_handle(), false))) { |
| 468 windowless_canvas_.reset(); |
| 469 background_canvas_.reset(); |
| 470 return; |
| 471 } |
| 472 |
| 465 if (background_buffer) { | 473 if (background_buffer) { |
| 466 background_canvas_.reset(new skia::PlatformCanvas( | 474 background_canvas_.reset(new skia::PlatformCanvas); |
| 467 delegate_->GetRect().width(), | 475 if (!background_canvas_->initialize( |
| 468 delegate_->GetRect().height(), | 476 delegate_->GetRect().width(), |
| 469 true, | 477 delegate_->GetRect().height(), |
| 470 win_util::GetSectionFromProcess(background_buffer, | 478 true, |
| 471 channel_->renderer_handle(), false))); | 479 win_util::GetSectionFromProcess(background_buffer, |
| 480 channel_->renderer_handle(), false))) { |
| 481 windowless_canvas_.reset(); |
| 482 background_canvas_.reset(); |
| 483 return; |
| 484 } |
| 472 } | 485 } |
| 473 } | 486 } |
| 474 | 487 |
| 475 #elif defined(OS_MACOSX) | 488 #elif defined(OS_MACOSX) |
| 476 | 489 |
| 477 void WebPluginProxy::SetWindowlessBuffer( | 490 void WebPluginProxy::SetWindowlessBuffer( |
| 478 const TransportDIB::Handle& windowless_buffer, | 491 const TransportDIB::Handle& windowless_buffer, |
| 479 const TransportDIB::Handle& background_buffer) { | 492 const TransportDIB::Handle& background_buffer) { |
| 480 // Convert the shared memory handle to a handle that works in our process, | 493 // Convert the shared memory handle to a handle that works in our process, |
| 481 // and then use that to create a CGContextRef. | 494 // and then use that to create a CGContextRef. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 while (index != resource_clients_.end()) { | 583 while (index != resource_clients_.end()) { |
| 571 WebPluginResourceClient* client = (*index).second; | 584 WebPluginResourceClient* client = (*index).second; |
| 572 | 585 |
| 573 if (client == resource_client) { | 586 if (client == resource_client) { |
| 574 resource_clients_.erase(index++); | 587 resource_clients_.erase(index++); |
| 575 } else { | 588 } else { |
| 576 index++; | 589 index++; |
| 577 } | 590 } |
| 578 } | 591 } |
| 579 } | 592 } |
| OLD | NEW |