| 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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 637 |
| 638 // Disable compositing in guests until we have compositing path implemented | 638 // Disable compositing in guests until we have compositing path implemented |
| 639 // for guests. | 639 // for guests. |
| 640 bool guest_compositing_enabled = !command_line.HasSwitch( | 640 bool guest_compositing_enabled = !command_line.HasSwitch( |
| 641 switches::kDisableBrowserPluginCompositing); | 641 switches::kDisableBrowserPluginCompositing); |
| 642 if (rvh->GetProcess()->IsGuest() && !guest_compositing_enabled) { | 642 if (rvh->GetProcess()->IsGuest() && !guest_compositing_enabled) { |
| 643 prefs.force_compositing_mode = false; | 643 prefs.force_compositing_mode = false; |
| 644 prefs.accelerated_compositing_enabled = false; | 644 prefs.accelerated_compositing_enabled = false; |
| 645 } | 645 } |
| 646 | 646 |
| 647 #if defined(OS_LINUX) && !defined(USE_AURA) | |
| 648 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957 | |
| 649 WebContentsImpl* web_contents = | |
| 650 static_cast<WebContentsImpl*>(WebContents::FromRenderViewHost(rvh)); | |
| 651 if (web_contents && web_contents->capturer_count_ > 0) { | |
| 652 prefs.accelerated_compositing_enabled = false; | |
| 653 } | |
| 654 #endif | |
| 655 | |
| 656 return prefs; | 647 return prefs; |
| 657 } | 648 } |
| 658 | 649 |
| 659 RenderViewHostManager* WebContentsImpl::GetRenderManagerForTesting() { | 650 RenderViewHostManager* WebContentsImpl::GetRenderManagerForTesting() { |
| 660 return &render_manager_; | 651 return &render_manager_; |
| 661 } | 652 } |
| 662 | 653 |
| 663 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, | 654 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
| 664 const IPC::Message& message) { | 655 const IPC::Message& message) { |
| 665 if (GetWebUI() && | 656 if (GetWebUI() && |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 | 982 |
| 992 bool WebContentsImpl::DisplayedInsecureContent() const { | 983 bool WebContentsImpl::DisplayedInsecureContent() const { |
| 993 return displayed_insecure_content_; | 984 return displayed_insecure_content_; |
| 994 } | 985 } |
| 995 | 986 |
| 996 void WebContentsImpl::IncrementCapturerCount() { | 987 void WebContentsImpl::IncrementCapturerCount() { |
| 997 DCHECK(!is_being_destroyed_); | 988 DCHECK(!is_being_destroyed_); |
| 998 ++capturer_count_; | 989 ++capturer_count_; |
| 999 DVLOG(1) << "There are now " << capturer_count_ | 990 DVLOG(1) << "There are now " << capturer_count_ |
| 1000 << " capturing(s) of WebContentsImpl@" << this; | 991 << " capturing(s) of WebContentsImpl@" << this; |
| 1001 | |
| 1002 #if defined(OS_LINUX) && !defined(USE_AURA) | |
| 1003 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957 | |
| 1004 if (capturer_count_ == 1) { | |
| 1005 // Force a WebkitPreferences reload to disable compositing for snapshots. | |
| 1006 RenderViewHost* rvh = GetRenderViewHost(); | |
| 1007 if (rvh) | |
| 1008 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); | |
| 1009 } | |
| 1010 #endif | |
| 1011 } | 992 } |
| 1012 | 993 |
| 1013 void WebContentsImpl::DecrementCapturerCount() { | 994 void WebContentsImpl::DecrementCapturerCount() { |
| 1014 --capturer_count_; | 995 --capturer_count_; |
| 1015 DVLOG(1) << "There are now " << capturer_count_ | 996 DVLOG(1) << "There are now " << capturer_count_ |
| 1016 << " capturing(s) of WebContentsImpl@" << this; | 997 << " capturing(s) of WebContentsImpl@" << this; |
| 1017 DCHECK_LE(0, capturer_count_); | 998 DCHECK_LE(0, capturer_count_); |
| 1018 | 999 |
| 1019 if (is_being_destroyed_) | 1000 if (is_being_destroyed_) |
| 1020 return; | 1001 return; |
| 1021 | 1002 |
| 1022 #if defined(OS_LINUX) && !defined(USE_AURA) | |
| 1023 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957 | |
| 1024 if (capturer_count_ == 0) { | |
| 1025 // Force a WebkitPreferences reload to re-enable compositing. | |
| 1026 RenderViewHost* rvh = GetRenderViewHost(); | |
| 1027 if (rvh) | |
| 1028 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); | |
| 1029 } | |
| 1030 #endif | |
| 1031 | |
| 1032 // While capturer_count_ was greater than zero, the WasHidden() calls to RWHV | 1003 // While capturer_count_ was greater than zero, the WasHidden() calls to RWHV |
| 1033 // were being prevented. If there are no more capturers, make the call now. | 1004 // were being prevented. If there are no more capturers, make the call now. |
| 1034 if (capturer_count_ == 0 && !should_normally_be_visible_) { | 1005 if (capturer_count_ == 0 && !should_normally_be_visible_) { |
| 1035 DVLOG(1) << "Executing delayed WasHidden()."; | 1006 DVLOG(1) << "Executing delayed WasHidden()."; |
| 1036 WasHidden(); | 1007 WasHidden(); |
| 1037 } | 1008 } |
| 1038 } | 1009 } |
| 1039 | 1010 |
| 1040 bool WebContentsImpl::IsCrashed() const { | 1011 bool WebContentsImpl::IsCrashed() const { |
| 1041 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || | 1012 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || |
| (...skipping 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3530 } | 3501 } |
| 3531 | 3502 |
| 3532 BrowserPluginGuestManager* | 3503 BrowserPluginGuestManager* |
| 3533 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3504 WebContentsImpl::GetBrowserPluginGuestManager() const { |
| 3534 return static_cast<BrowserPluginGuestManager*>( | 3505 return static_cast<BrowserPluginGuestManager*>( |
| 3535 GetBrowserContext()->GetUserData( | 3506 GetBrowserContext()->GetUserData( |
| 3536 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3507 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
| 3537 } | 3508 } |
| 3538 | 3509 |
| 3539 } // namespace content | 3510 } // namespace content |
| OLD | NEW |