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

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

Issue 12746009: Revert 189969 "Add RenderWidgetHost::GetSnapshotFromRenderer met..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1450/src/
Patch Set: 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 | Annotate | Revision Log
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
639 return prefs; 648 return prefs;
640 } 649 }
641 650
642 RenderViewHostManager* WebContentsImpl::GetRenderManagerForTesting() { 651 RenderViewHostManager* WebContentsImpl::GetRenderManagerForTesting() {
643 return &render_manager_; 652 return &render_manager_;
644 } 653 }
645 654
646 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, 655 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
647 const IPC::Message& message) { 656 const IPC::Message& message) {
648 if (GetWebUI() && 657 if (GetWebUI() &&
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 984
976 bool WebContentsImpl::DisplayedInsecureContent() const { 985 bool WebContentsImpl::DisplayedInsecureContent() const {
977 return displayed_insecure_content_; 986 return displayed_insecure_content_;
978 } 987 }
979 988
980 void WebContentsImpl::IncrementCapturerCount() { 989 void WebContentsImpl::IncrementCapturerCount() {
981 DCHECK(!is_being_destroyed_); 990 DCHECK(!is_being_destroyed_);
982 ++capturer_count_; 991 ++capturer_count_;
983 DVLOG(1) << "There are now " << capturer_count_ 992 DVLOG(1) << "There are now " << capturer_count_
984 << " capturing(s) of WebContentsImpl@" << this; 993 << " 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
985 } 1004 }
986 1005
987 void WebContentsImpl::DecrementCapturerCount() { 1006 void WebContentsImpl::DecrementCapturerCount() {
988 --capturer_count_; 1007 --capturer_count_;
989 DVLOG(1) << "There are now " << capturer_count_ 1008 DVLOG(1) << "There are now " << capturer_count_
990 << " capturing(s) of WebContentsImpl@" << this; 1009 << " capturing(s) of WebContentsImpl@" << this;
991 DCHECK_LE(0, capturer_count_); 1010 DCHECK_LE(0, capturer_count_);
992 1011
993 if (is_being_destroyed_) 1012 if (is_being_destroyed_)
994 return; 1013 return;
995 1014
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
996 // While capturer_count_ was greater than zero, the WasHidden() calls to RWHV 1025 // While capturer_count_ was greater than zero, the WasHidden() calls to RWHV
997 // were being prevented. If there are no more capturers, make the call now. 1026 // were being prevented. If there are no more capturers, make the call now.
998 if (capturer_count_ == 0 && !should_normally_be_visible_) { 1027 if (capturer_count_ == 0 && !should_normally_be_visible_) {
999 DVLOG(1) << "Executing delayed WasHidden()."; 1028 DVLOG(1) << "Executing delayed WasHidden().";
1000 WasHidden(); 1029 WasHidden();
1001 } 1030 }
1002 } 1031 }
1003 1032
1004 bool WebContentsImpl::IsCrashed() const { 1033 bool WebContentsImpl::IsCrashed() const {
1005 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || 1034 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED ||
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after
3481 } 3510 }
3482 3511
3483 BrowserPluginGuestManager* 3512 BrowserPluginGuestManager*
3484 WebContentsImpl::GetBrowserPluginGuestManager() const { 3513 WebContentsImpl::GetBrowserPluginGuestManager() const {
3485 return static_cast<BrowserPluginGuestManager*>( 3514 return static_cast<BrowserPluginGuestManager*>(
3486 GetBrowserContext()->GetUserData( 3515 GetBrowserContext()->GetUserData(
3487 browser_plugin::kBrowserPluginGuestManagerKeyName)); 3516 browser_plugin::kBrowserPluginGuestManagerKeyName));
3488 } 3517 }
3489 3518
3490 } // namespace content 3519 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_gtk.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698