Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 12881005: Allow CopyFromBackingStore to fallback to copying from the renderer side if the accelerated surface… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unused include Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 629
630 // Disable compositing in guests until we have compositing path implemented 630 // Disable compositing in guests until we have compositing path implemented
631 // for guests. 631 // for guests.
632 bool guest_compositing_enabled = !command_line.HasSwitch( 632 bool guest_compositing_enabled = !command_line.HasSwitch(
633 switches::kDisableBrowserPluginCompositing); 633 switches::kDisableBrowserPluginCompositing);
634 if (rvh->GetProcess()->IsGuest() && !guest_compositing_enabled) { 634 if (rvh->GetProcess()->IsGuest() && !guest_compositing_enabled) {
635 prefs.force_compositing_mode = false; 635 prefs.force_compositing_mode = false;
636 prefs.accelerated_compositing_enabled = false; 636 prefs.accelerated_compositing_enabled = false;
637 } 637 }
638 638
639 #if defined(OS_LINUX) && !defined(USE_AURA)
640 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957
641 WebContentsImpl* web_contents =
642 static_cast<WebContentsImpl*>(WebContents::FromRenderViewHost(rvh));
643 if (web_contents && web_contents->capturer_count_ > 0) {
644 prefs.accelerated_compositing_enabled = false;
645 }
646 #endif
647
648 return prefs; 639 return prefs;
649 } 640 }
650 641
651 RenderViewHostManager* WebContentsImpl::GetRenderManagerForTesting() { 642 RenderViewHostManager* WebContentsImpl::GetRenderManagerForTesting() {
652 return &render_manager_; 643 return &render_manager_;
653 } 644 }
654 645
655 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, 646 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
656 const IPC::Message& message) { 647 const IPC::Message& message) {
657 if (GetWebUI() && 648 if (GetWebUI() &&
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 975
985 bool WebContentsImpl::DisplayedInsecureContent() const { 976 bool WebContentsImpl::DisplayedInsecureContent() const {
986 return displayed_insecure_content_; 977 return displayed_insecure_content_;
987 } 978 }
988 979
989 void WebContentsImpl::IncrementCapturerCount() { 980 void WebContentsImpl::IncrementCapturerCount() {
990 DCHECK(!is_being_destroyed_); 981 DCHECK(!is_being_destroyed_);
991 ++capturer_count_; 982 ++capturer_count_;
992 DVLOG(1) << "There are now " << capturer_count_ 983 DVLOG(1) << "There are now " << capturer_count_
993 << " capturing(s) of WebContentsImpl@" << this; 984 << " capturing(s) of WebContentsImpl@" << this;
994
995 #if defined(OS_LINUX) && !defined(USE_AURA)
996 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957
997 if (capturer_count_ == 1) {
998 // Force a WebkitPreferences reload to disable compositing for snapshots.
999 RenderViewHost* rvh = GetRenderViewHost();
1000 if (rvh)
1001 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences());
1002 }
1003 #endif
1004 } 985 }
1005 986
1006 void WebContentsImpl::DecrementCapturerCount() { 987 void WebContentsImpl::DecrementCapturerCount() {
1007 --capturer_count_; 988 --capturer_count_;
1008 DVLOG(1) << "There are now " << capturer_count_ 989 DVLOG(1) << "There are now " << capturer_count_
1009 << " capturing(s) of WebContentsImpl@" << this; 990 << " capturing(s) of WebContentsImpl@" << this;
1010 DCHECK_LE(0, capturer_count_); 991 DCHECK_LE(0, capturer_count_);
1011 992
1012 if (is_being_destroyed_) 993 if (is_being_destroyed_)
1013 return; 994 return;
1014 995
1015 #if defined(OS_LINUX) && !defined(USE_AURA)
1016 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957
1017 if (capturer_count_ == 0) {
1018 // Force a WebkitPreferences reload to re-enable compositing.
1019 RenderViewHost* rvh = GetRenderViewHost();
1020 if (rvh)
1021 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences());
1022 }
1023 #endif
1024
1025 // While capturer_count_ was greater than zero, the WasHidden() calls to RWHV 996 // While capturer_count_ was greater than zero, the WasHidden() calls to RWHV
1026 // were being prevented. If there are no more capturers, make the call now. 997 // were being prevented. If there are no more capturers, make the call now.
1027 if (capturer_count_ == 0 && !should_normally_be_visible_) { 998 if (capturer_count_ == 0 && !should_normally_be_visible_) {
1028 DVLOG(1) << "Executing delayed WasHidden()."; 999 DVLOG(1) << "Executing delayed WasHidden().";
1029 WasHidden(); 1000 WasHidden();
1030 } 1001 }
1031 } 1002 }
1032 1003
1033 bool WebContentsImpl::IsCrashed() const { 1004 bool WebContentsImpl::IsCrashed() const {
1034 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || 1005 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED ||
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after
3510 } 3481 }
3511 3482
3512 BrowserPluginGuestManager* 3483 BrowserPluginGuestManager*
3513 WebContentsImpl::GetBrowserPluginGuestManager() const { 3484 WebContentsImpl::GetBrowserPluginGuestManager() const {
3514 return static_cast<BrowserPluginGuestManager*>( 3485 return static_cast<BrowserPluginGuestManager*>(
3515 GetBrowserContext()->GetUserData( 3486 GetBrowserContext()->GetUserData(
3516 browser_plugin::kBrowserPluginGuestManagerKeyName)); 3487 browser_plugin::kBrowserPluginGuestManagerKeyName));
3517 } 3488 }
3518 3489
3519 } // namespace content 3490 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698