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

Side by Side Diff: chrome/browser/renderer_host/browser_render_process_host.cc

Issue 6006006: Show OOM notification bar in all tabs sharing same render process (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: code cleanup Created 9 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "chrome/browser/renderer_host/browser_render_process_host.h" 8 #include "chrome/browser/renderer_host/browser_render_process_host.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionAddListener, 992 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionAddListener,
993 OnExtensionAddListener) 993 OnExtensionAddListener)
994 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRemoveListener, 994 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRemoveListener,
995 OnExtensionRemoveListener) 995 OnExtensionRemoveListener)
996 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionCloseChannel, 996 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionCloseChannel,
997 OnExtensionCloseChannel) 997 OnExtensionCloseChannel)
998 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, 998 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
999 OnUserMetricsRecordAction) 999 OnUserMetricsRecordAction)
1000 IPC_MESSAGE_HANDLER(ViewHostMsg_SpellChecker_RequestDictionary, 1000 IPC_MESSAGE_HANDLER(ViewHostMsg_SpellChecker_RequestDictionary,
1001 OnSpellCheckerRequestDictionary) 1001 OnSpellCheckerRequestDictionary)
1002 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RenderProcessOutOfJSMemory,
1003 OnRenderProcessOutOfJSMemory)
1002 IPC_MESSAGE_UNHANDLED_ERROR() 1004 IPC_MESSAGE_UNHANDLED_ERROR()
1003 IPC_END_MESSAGE_MAP_EX() 1005 IPC_END_MESSAGE_MAP_EX()
1004 1006
1005 if (!msg_is_ok) { 1007 if (!msg_is_ok) {
1006 // The message had a handler, but its de-serialization failed. 1008 // The message had a handler, but its de-serialization failed.
1007 // We consider this a capital crime. Kill the renderer if we have one. 1009 // We consider this a capital crime. Kill the renderer if we have one.
1008 ReceivedBadMessage(msg.type()); 1010 ReceivedBadMessage(msg.type());
1009 } 1011 }
1010 return; 1012 return;
1011 } 1013 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 // it to the renderer. 1246 // it to the renderer.
1245 InitSpellChecker(); 1247 InitSpellChecker();
1246 } else { 1248 } else {
1247 // We may have gotten multiple requests from different renderers. We don't 1249 // We may have gotten multiple requests from different renderers. We don't
1248 // want to initialize multiple times in this case, so we set |force| to 1250 // want to initialize multiple times in this case, so we set |force| to
1249 // false. 1251 // false.
1250 profile()->ReinitializeSpellCheckHost(false); 1252 profile()->ReinitializeSpellCheckHost(false);
1251 } 1253 }
1252 } 1254 }
1253 1255
1256 void BrowserRenderProcessHost::OnRenderProcessOutOfJSMemory(
1257 IPC::Message* reply_msg) {
1258 Send(reply_msg);
1259
1260 // Show OOM notification bar in all tabs sharing this render process.
1261 IDMap<IPC::Channel::Listener>::iterator iter(&listeners_);
1262 while (!iter.IsAtEnd()) {
1263 iter.GetCurrentValue()->OnMessageReceived(
1264 ViewHostMsg_JSOutOfMemory(iter.GetCurrentKey()));
1265 iter.Advance();
1266 }
1267 }
1268
1254 void BrowserRenderProcessHost::AddSpellCheckWord(const std::string& word) { 1269 void BrowserRenderProcessHost::AddSpellCheckWord(const std::string& word) {
1255 Send(new ViewMsg_SpellChecker_WordAdded(word)); 1270 Send(new ViewMsg_SpellChecker_WordAdded(word));
1256 } 1271 }
1257 1272
1258 void BrowserRenderProcessHost::InitSpellChecker() { 1273 void BrowserRenderProcessHost::InitSpellChecker() {
1259 SpellCheckHost* spellcheck_host = profile()->GetSpellCheckHost(); 1274 SpellCheckHost* spellcheck_host = profile()->GetSpellCheckHost();
1260 if (spellcheck_host) { 1275 if (spellcheck_host) {
1261 PrefService* prefs = profile()->GetPrefs(); 1276 PrefService* prefs = profile()->GetPrefs();
1262 IPC::PlatformFileForTransit file; 1277 IPC::PlatformFileForTransit file;
1263 1278
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 IPC::PlatformFileForTransit file; 1321 IPC::PlatformFileForTransit file;
1307 #if defined(OS_POSIX) 1322 #if defined(OS_POSIX)
1308 file = base::FileDescriptor(model_file, false); 1323 file = base::FileDescriptor(model_file, false);
1309 #elif defined(OS_WIN) 1324 #elif defined(OS_WIN)
1310 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, 1325 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0,
1311 false, DUPLICATE_SAME_ACCESS); 1326 false, DUPLICATE_SAME_ACCESS);
1312 #endif 1327 #endif
1313 Send(new ViewMsg_SetPhishingModel(file)); 1328 Send(new ViewMsg_SetPhishingModel(file));
1314 } 1329 }
1315 } 1330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698