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

Side by Side Diff: content/browser/memory/memory_coordinator_impl.cc

Issue 2726983006: Clean up after each MemoryCoordinatorImpl test (Closed)
Patch Set: Created 3 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
« no previous file with comments | « base/memory/memory_coordinator_proxy.cc ('k') | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/memory/memory_coordinator_impl.h" 5 #include "content/browser/memory/memory_coordinator_impl.h"
6 6
7 #include "base/memory/memory_coordinator_client_registry.h" 7 #include "base/memory/memory_coordinator_client_registry.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 MemoryCoordinatorImpl::MemoryCoordinatorImpl( 169 MemoryCoordinatorImpl::MemoryCoordinatorImpl(
170 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 170 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
171 std::unique_ptr<MemoryMonitor> memory_monitor) 171 std::unique_ptr<MemoryMonitor> memory_monitor)
172 : delegate_(GetContentClient()->browser()->GetMemoryCoordinatorDelegate()), 172 : delegate_(GetContentClient()->browser()->GetMemoryCoordinatorDelegate()),
173 memory_monitor_(std::move(memory_monitor)), 173 memory_monitor_(std::move(memory_monitor)),
174 state_updater_(base::MakeUnique<MemoryStateUpdater>(this, task_runner)) { 174 state_updater_(base::MakeUnique<MemoryStateUpdater>(this, task_runner)) {
175 DCHECK(memory_monitor_.get()); 175 DCHECK(memory_monitor_.get());
176 base::MemoryCoordinatorProxy::SetMemoryCoordinator(this); 176 base::MemoryCoordinatorProxy::SetMemoryCoordinator(this);
177 } 177 }
178 178
179 MemoryCoordinatorImpl::~MemoryCoordinatorImpl() {} 179 MemoryCoordinatorImpl::~MemoryCoordinatorImpl() {
180 base::MemoryCoordinatorProxy::ResetGlobals();
sadrul 2017/03/03 17:40:41 Maybe this could just call: base::MemoryCoordina
dimaa1 2017/03/03 18:30:05 These tests are failing because we execute this me
sadrul 2017/03/03 18:45:01 Yep. That's what I suggested SetMemoryCoordinator(
dimaa1 2017/03/03 18:52:02 Great idea!
181 }
180 182
181 void MemoryCoordinatorImpl::Start() { 183 void MemoryCoordinatorImpl::Start() {
182 DCHECK(CalledOnValidThread()); 184 DCHECK(CalledOnValidThread());
183 DCHECK(last_state_change_.is_null()); 185 DCHECK(last_state_change_.is_null());
184 186
185 notification_registrar_.Add( 187 notification_registrar_.Add(
186 this, NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, 188 this, NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
187 NotificationService::AllBrowserContextsAndSources()); 189 NotificationService::AllBrowserContextsAndSources());
188 last_state_change_ = base::TimeTicks::Now(); 190 last_state_change_ = base::TimeTicks::Now();
189 state_updater_->ScheduleUpdateState(base::TimeDelta()); 191 state_updater_->ScheduleUpdateState(base::TimeDelta());
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 464
463 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {} 465 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {}
464 466
465 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) { 467 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) {
466 // This is a nop, but exists for compatibility with STL containers. 468 // This is a nop, but exists for compatibility with STL containers.
467 } 469 }
468 470
469 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {} 471 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {}
470 472
471 } // namespace content 473 } // namespace content
OLDNEW
« no previous file with comments | « base/memory/memory_coordinator_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698