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

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

Issue 1406133002: Several Site Details / Memory metrics fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_isolate_apps4
Patch Set: Self-review fixes / simplifications Created 5 years, 2 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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 void NotifyCacheOnIO( 160 void NotifyCacheOnIO(
161 scoped_refptr<net::URLRequestContextGetter> request_context, 161 scoped_refptr<net::URLRequestContextGetter> request_context,
162 const GURL& url, 162 const GURL& url,
163 const std::string& http_method) { 163 const std::string& http_method) {
164 net::HttpCache* cache = request_context->GetURLRequestContext()-> 164 net::HttpCache* cache = request_context->GetURLRequestContext()->
165 http_transaction_factory()->GetCache(); 165 http_transaction_factory()->GetCache();
166 if (cache) 166 if (cache)
167 cache->OnExternalCacheHit(url, http_method); 167 cache->OnExternalCacheHit(url, http_method);
168 } 168 }
169 169
170 // Helper function for retrieving all the sites in a frame tree.
171 bool CollectSites(BrowserContext* context,
172 std::set<GURL>* sites,
173 FrameTreeNode* node) {
174 // Record about:blank as a real (process-having) site only if the SiteInstance
175 // is unassigned. Do not otherwise depend on the siteinstance's site URL,
176 // since its value reflects the current process model, and this function
177 // should behave identically across all process models.
178 if (node->current_url() == GURL(url::kAboutBlankURL) &&
179 node->current_frame_host()->GetSiteInstance()->HasSite()) {
180 return true;
181 }
182 sites->insert(SiteInstance::GetSiteForURL(context, node->current_url()));
183 return true;
184 }
185
186 bool FindMatchingProcess(int render_process_id, 170 bool FindMatchingProcess(int render_process_id,
187 bool* did_match_process, 171 bool* did_match_process,
188 FrameTreeNode* node) { 172 FrameTreeNode* node) {
189 if (node->current_frame_host()->GetProcess()->GetID() == render_process_id) { 173 if (node->current_frame_host()->GetProcess()->GetID() == render_process_id) {
190 *did_match_process = true; 174 *did_match_process = true;
191 return false; 175 return false;
192 } 176 }
193 return true; 177 return true;
194 } 178 }
195 179
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 } 1014 }
1031 1015
1032 uint64 WebContentsImpl::GetUploadSize() const { 1016 uint64 WebContentsImpl::GetUploadSize() const {
1033 return upload_size_; 1017 return upload_size_;
1034 } 1018 }
1035 1019
1036 uint64 WebContentsImpl::GetUploadPosition() const { 1020 uint64 WebContentsImpl::GetUploadPosition() const {
1037 return upload_position_; 1021 return upload_position_;
1038 } 1022 }
1039 1023
1040 std::set<GURL> WebContentsImpl::GetSitesInTab() const {
1041 std::set<GURL> sites;
1042 frame_tree_.ForEach(base::Bind(&CollectSites,
1043 base::Unretained(GetBrowserContext()),
1044 base::Unretained(&sites)));
1045 return sites;
1046 }
1047
1048 const std::string& WebContentsImpl::GetEncoding() const { 1024 const std::string& WebContentsImpl::GetEncoding() const {
1049 return canonical_encoding_; 1025 return canonical_encoding_;
1050 } 1026 }
1051 1027
1052 bool WebContentsImpl::DisplayedInsecureContent() const { 1028 bool WebContentsImpl::DisplayedInsecureContent() const {
1053 return displayed_insecure_content_; 1029 return displayed_insecure_content_;
1054 } 1030 }
1055 1031
1056 void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) { 1032 void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) {
1057 DCHECK(!is_being_destroyed_); 1033 DCHECK(!is_being_destroyed_);
(...skipping 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after
4649 return NULL; 4625 return NULL;
4650 } 4626 }
4651 4627
4652 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4628 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4653 force_disable_overscroll_content_ = force_disable; 4629 force_disable_overscroll_content_ = force_disable;
4654 if (view_) 4630 if (view_)
4655 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4631 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4656 } 4632 }
4657 4633
4658 } // namespace content 4634 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698