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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 | 1015 |
1016 const std::string& WebContentsImpl::GetEncoding() const { | 1016 const std::string& WebContentsImpl::GetEncoding() const { |
1017 return encoding_; | 1017 return encoding_; |
1018 } | 1018 } |
1019 | 1019 |
1020 bool WebContentsImpl::DisplayedInsecureContent() const { | 1020 bool WebContentsImpl::DisplayedInsecureContent() const { |
1021 return displayed_insecure_content_; | 1021 return displayed_insecure_content_; |
1022 } | 1022 } |
1023 | 1023 |
1024 void WebContentsImpl::IncrementCapturerCount() { | 1024 void WebContentsImpl::IncrementCapturerCount() { |
| 1025 DCHECK(!is_being_destroyed_); |
1025 ++capturer_count_; | 1026 ++capturer_count_; |
1026 DVLOG(1) << "There are now " << capturer_count_ | 1027 DVLOG(1) << "There are now " << capturer_count_ |
1027 << " capturing(s) of WebContentsImpl@" << this; | 1028 << " capturing(s) of WebContentsImpl@" << this; |
1028 | 1029 |
1029 #if defined(OS_LINUX) && !defined(USE_AURA) | 1030 #if defined(OS_LINUX) && !defined(USE_AURA) |
1030 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957 | 1031 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957 |
1031 if (capturer_count_ == 1) { | 1032 if (capturer_count_ == 1) { |
1032 // Force a WebkitPreferences reload to disable compositing for snapshots. | 1033 // Force a WebkitPreferences reload to disable compositing for snapshots. |
1033 RenderViewHost* rvh = GetRenderViewHost(); | 1034 RenderViewHost* rvh = GetRenderViewHost(); |
1034 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); | 1035 if (rvh) |
| 1036 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); |
1035 } | 1037 } |
1036 #endif | 1038 #endif |
1037 } | 1039 } |
1038 | 1040 |
1039 void WebContentsImpl::DecrementCapturerCount() { | 1041 void WebContentsImpl::DecrementCapturerCount() { |
1040 --capturer_count_; | 1042 --capturer_count_; |
1041 DVLOG(1) << "There are now " << capturer_count_ | 1043 DVLOG(1) << "There are now " << capturer_count_ |
1042 << " capturing(s) of WebContentsImpl@" << this; | 1044 << " capturing(s) of WebContentsImpl@" << this; |
1043 DCHECK_LE(0, capturer_count_); | 1045 DCHECK_LE(0, capturer_count_); |
1044 | 1046 |
| 1047 if (is_being_destroyed_) |
| 1048 return; |
| 1049 |
1045 #if defined(OS_LINUX) && !defined(USE_AURA) | 1050 #if defined(OS_LINUX) && !defined(USE_AURA) |
1046 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957 | 1051 // Temporary fix for Linux non-Aura capturing. http://crbug.com/174957 |
1047 if (capturer_count_ == 0) { | 1052 if (capturer_count_ == 0) { |
1048 // Force a WebkitPreferences reload to re-enable compositing. | 1053 // Force a WebkitPreferences reload to re-enable compositing. |
1049 RenderViewHost* rvh = GetRenderViewHost(); | 1054 RenderViewHost* rvh = GetRenderViewHost(); |
1050 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); | 1055 if (rvh) |
| 1056 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); |
1051 } | 1057 } |
1052 #endif | 1058 #endif |
1053 | 1059 |
1054 // While capturer_count_ was greater than zero, the WasHidden() calls to RWHV | 1060 // While capturer_count_ was greater than zero, the WasHidden() calls to RWHV |
1055 // were being prevented. If there are no more capturers, make the call now. | 1061 // were being prevented. If there are no more capturers, make the call now. |
1056 if (capturer_count_ == 0 && !should_normally_be_visible_) { | 1062 if (capturer_count_ == 0 && !should_normally_be_visible_) { |
1057 DVLOG(1) << "Executing delayed WasHidden()."; | 1063 DVLOG(1) << "Executing delayed WasHidden()."; |
1058 WasHidden(); | 1064 WasHidden(); |
1059 } | 1065 } |
1060 } | 1066 } |
(...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 | 3505 |
3500 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { | 3506 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { |
3501 return browser_plugin_guest_.get(); | 3507 return browser_plugin_guest_.get(); |
3502 } | 3508 } |
3503 | 3509 |
3504 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { | 3510 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { |
3505 return browser_plugin_embedder_.get(); | 3511 return browser_plugin_embedder_.get(); |
3506 } | 3512 } |
3507 | 3513 |
3508 } // namespace content | 3514 } // namespace content |
OLD | NEW |