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

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 2893863002: Disable recoding purge-and-suspend memory growth temporarily (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | no next file » | 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/renderer/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 return; 1670 return;
1671 1671
1672 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); 1672 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory();
1673 needs_to_record_first_active_paint_ = true; 1673 needs_to_record_first_active_paint_ = true;
1674 1674
1675 RendererMemoryMetrics memory_metrics; 1675 RendererMemoryMetrics memory_metrics;
1676 if (!GetRendererMemoryMetrics(&memory_metrics)) 1676 if (!GetRendererMemoryMetrics(&memory_metrics))
1677 return; 1677 return;
1678 1678
1679 purge_and_suspend_memory_metrics_ = memory_metrics; 1679 purge_and_suspend_memory_metrics_ = memory_metrics;
1680 // record how many memory usage increases after purged.
1681 // Since RenderThreadImpl is kept alive while its render process is alive,
1682 // it is possible to use base::Unretained(this) here.
1683 GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask(
1684 FROM_HERE,
1685 base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics,
1686 base::Unretained(this), "30min", process_foregrounded_count_),
1687 base::TimeDelta::FromMinutes(30));
1688 GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask(
1689 FROM_HERE,
1690 base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics,
1691 base::Unretained(this), "60min", process_foregrounded_count_),
1692 base::TimeDelta::FromMinutes(60));
1693 GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask(
1694 FROM_HERE,
1695 base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics,
1696 base::Unretained(this), "90min", process_foregrounded_count_),
1697 base::TimeDelta::FromMinutes(90));
1698 } 1680 }
1699 1681
1700 // TODO(tasak): Replace the following GetMallocUsage() with memory-infra 1682 // TODO(tasak): Replace the following GetMallocUsage() with memory-infra
1701 // when it is possible to run memory-infra without tracing. 1683 // when it is possible to run memory-infra without tracing.
1702 #if defined(OS_WIN) 1684 #if defined(OS_WIN)
1703 namespace { 1685 namespace {
1704 1686
1705 static size_t GetMallocUsage() { 1687 static size_t GetMallocUsage() {
1706 // Iterate through whichever heap the CRT is using. 1688 // Iterate through whichever heap the CRT is using.
1707 HANDLE crt_heap = reinterpret_cast<HANDLE>(_get_heap_handle()); 1689 HANDLE crt_heap = reinterpret_cast<HANDLE>(_get_heap_handle());
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 } 2440 }
2459 } 2441 }
2460 2442
2461 void RenderThreadImpl::OnRendererInterfaceRequest( 2443 void RenderThreadImpl::OnRendererInterfaceRequest(
2462 mojom::RendererAssociatedRequest request) { 2444 mojom::RendererAssociatedRequest request) {
2463 DCHECK(!renderer_binding_.is_bound()); 2445 DCHECK(!renderer_binding_.is_bound());
2464 renderer_binding_.Bind(std::move(request)); 2446 renderer_binding_.Bind(std::move(request));
2465 } 2447 }
2466 2448
2467 } // namespace content 2449 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698