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

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

Issue 2469123003: Call MessageFilter clean up handlers even for pending filters (Closed)
Patch Set: rebase Created 4 years, 1 month 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 | ipc/ipc_channel_proxy.cc » ('j') | ipc/ipc_channel_proxy.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_pressure_controller_impl.h" 5 #include "content/browser/memory/memory_pressure_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/browser/memory/memory_message_filter.h" 8 #include "content/browser/memory/memory_message_filter.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
(...skipping 21 matching lines...) Expand all
32 filter->SendSetPressureNotificationsSuppressed(true); 32 filter->SendSetPressureNotificationsSuppressed(true);
33 } 33 }
34 34
35 void MemoryPressureControllerImpl::OnMemoryMessageFilterRemoved( 35 void MemoryPressureControllerImpl::OnMemoryMessageFilterRemoved(
36 MemoryMessageFilter* filter) { 36 MemoryMessageFilter* filter) {
37 DCHECK_CURRENTLY_ON(BrowserThread::IO); 37 DCHECK_CURRENTLY_ON(BrowserThread::IO);
38 38
39 // Remove the message filter from the set of all memory message filters, 39 // Remove the message filter from the set of all memory message filters,
40 // ensuring that it was there beforehand. 40 // ensuring that it was there beforehand.
41 auto it = memory_message_filters_.find(filter->process_host()); 41 auto it = memory_message_filters_.find(filter->process_host());
42 DCHECK(it != memory_message_filters_.end()); 42 if (it == memory_message_filters_.end())
43 return;
43 DCHECK_EQ(filter, it->second); 44 DCHECK_EQ(filter, it->second);
44 memory_message_filters_.erase(it); 45 memory_message_filters_.erase(it);
45 } 46 }
46 47
47 // static 48 // static
48 MemoryPressureControllerImpl* MemoryPressureControllerImpl::GetInstance() { 49 MemoryPressureControllerImpl* MemoryPressureControllerImpl::GetInstance() {
49 return base::Singleton< 50 return base::Singleton<
50 MemoryPressureControllerImpl, 51 MemoryPressureControllerImpl,
51 base::LeakySingletonTraits<MemoryPressureControllerImpl>>::get(); 52 base::LeakySingletonTraits<MemoryPressureControllerImpl>>::get();
52 } 53 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (base::MemoryPressureListener::AreNotificationsSuppressed()) 127 if (base::MemoryPressureListener::AreNotificationsSuppressed())
127 return; 128 return;
128 129
129 // Find the appropriate message filter and dispatch the message. 130 // Find the appropriate message filter and dispatch the message.
130 auto it = memory_message_filters_.find(child_process_host); 131 auto it = memory_message_filters_.find(child_process_host);
131 if (it != memory_message_filters_.end()) 132 if (it != memory_message_filters_.end())
132 it->second->SendPressureNotification(level); 133 it->second->SendPressureNotification(level);
133 } 134 }
134 135
135 } // namespace content 136 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ipc/ipc_channel_proxy.cc » ('j') | ipc/ipc_channel_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698