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

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

Issue 2426733004: Bug fix: Use the last hidden time for purge + suspend (Closed)
Patch Set: (rebase) Created 4 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/browser/web_contents.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 } 1317 }
1318 1318
1319 base::TimeTicks WebContentsImpl::GetLastActiveTime() const { 1319 base::TimeTicks WebContentsImpl::GetLastActiveTime() const {
1320 return last_active_time_; 1320 return last_active_time_;
1321 } 1321 }
1322 1322
1323 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) { 1323 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) {
1324 last_active_time_ = last_active_time; 1324 last_active_time_ = last_active_time;
1325 } 1325 }
1326 1326
1327 base::TimeTicks WebContentsImpl::GetLastHiddenTime() const {
1328 return last_hidden_time_;
1329 }
1330
1327 void WebContentsImpl::WasShown() { 1331 void WebContentsImpl::WasShown() {
1328 controller_.SetActive(true); 1332 controller_.SetActive(true);
1329 1333
1330 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) { 1334 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
1331 if (view) { 1335 if (view) {
1332 view->Show(); 1336 view->Show();
1333 #if defined(OS_MACOSX) 1337 #if defined(OS_MACOSX)
1334 view->SetActive(true); 1338 view->SetActive(true);
1335 #endif 1339 #endif
1336 } 1340 }
(...skipping 20 matching lines...) Expand all
1357 // window, OnWindowPosChanged() notices and calls WasHidden() (which 1361 // window, OnWindowPosChanged() notices and calls WasHidden() (which
1358 // calls us). 1362 // calls us).
1359 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) { 1363 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
1360 if (view) 1364 if (view)
1361 view->Hide(); 1365 view->Hide();
1362 } 1366 }
1363 1367
1364 SendPageMessage(new PageMsg_WasHidden(MSG_ROUTING_NONE)); 1368 SendPageMessage(new PageMsg_WasHidden(MSG_ROUTING_NONE));
1365 } 1369 }
1366 1370
1371 last_hidden_time_ = base::TimeTicks::Now();
1372
1367 for (auto& observer : observers_) 1373 for (auto& observer : observers_)
1368 observer.WasHidden(); 1374 observer.WasHidden();
1369 1375
1370 should_normally_be_visible_ = false; 1376 should_normally_be_visible_ = false;
1371 } 1377 }
1372 1378
1373 void WebContentsImpl::WasOccluded() { 1379 void WebContentsImpl::WasOccluded() {
1374 if (capturer_count_ > 0) 1380 if (capturer_count_ > 0)
1375 return; 1381 return;
1376 1382
(...skipping 3811 matching lines...) Expand 10 before | Expand all | Expand 10 after
5188 dialog_manager_ = dialog_manager; 5194 dialog_manager_ = dialog_manager;
5189 } 5195 }
5190 5196
5191 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5197 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5192 auto it = binding_sets_.find(interface_name); 5198 auto it = binding_sets_.find(interface_name);
5193 if (it != binding_sets_.end()) 5199 if (it != binding_sets_.end())
5194 binding_sets_.erase(it); 5200 binding_sets_.erase(it);
5195 } 5201 }
5196 5202
5197 } // namespace content 5203 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/browser/web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698