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