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

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 8574070: Move enabling IPC logging for all child processes to the Content API. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/browser/ui/cocoa/about_ipc_controller.mm » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/browser_process_impl.h" 5 #include "chrome/browser/browser_process_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "chrome/common/chrome_notification_types.h" 61 #include "chrome/common/chrome_notification_types.h"
62 #include "chrome/common/chrome_paths.h" 62 #include "chrome/common/chrome_paths.h"
63 #include "chrome/common/chrome_switches.h" 63 #include "chrome/common/chrome_switches.h"
64 #include "chrome/common/extensions/extension_l10n_util.h" 64 #include "chrome/common/extensions/extension_l10n_util.h"
65 #include "chrome/common/extensions/extension_resource.h" 65 #include "chrome/common/extensions/extension_resource.h"
66 #include "chrome/common/json_pref_store.h" 66 #include "chrome/common/json_pref_store.h"
67 #include "chrome/common/pref_names.h" 67 #include "chrome/common/pref_names.h"
68 #include "chrome/common/switch_utils.h" 68 #include "chrome/common/switch_utils.h"
69 #include "chrome/common/url_constants.h" 69 #include "chrome/common/url_constants.h"
70 #include "chrome/installer/util/google_update_constants.h" 70 #include "chrome/installer/util/google_update_constants.h"
71 #include "content/browser/browser_child_process_host.h"
72 #include "content/browser/browser_process_sub_thread.h" 71 #include "content/browser/browser_process_sub_thread.h"
73 #include "content/browser/child_process_security_policy.h" 72 #include "content/browser/child_process_security_policy.h"
74 #include "content/browser/debugger/devtools_manager.h" 73 #include "content/browser/debugger/devtools_manager.h"
75 #include "content/browser/download/download_file_manager.h" 74 #include "content/browser/download/download_file_manager.h"
76 #include "content/browser/download/download_status_updater.h" 75 #include "content/browser/download/download_status_updater.h"
77 #include "content/browser/download/mhtml_generation_manager.h" 76 #include "content/browser/download/mhtml_generation_manager.h"
78 #include "content/browser/download/save_file_manager.h" 77 #include "content/browser/download/save_file_manager.h"
79 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 78 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
80 #include "content/browser/net/browser_online_state_observer.h" 79 #include "content/browser/net/browser_online_state_observer.h"
81 #include "content/browser/plugin_service.h" 80 #include "content/browser/plugin_service.h"
82 #include "content/browser/renderer_host/resource_dispatcher_host.h" 81 #include "content/browser/renderer_host/resource_dispatcher_host.h"
83 #include "content/public/browser/browser_thread.h" 82 #include "content/public/browser/browser_thread.h"
84 #include "content/public/browser/notification_details.h" 83 #include "content/public/browser/notification_details.h"
85 #include "content/public/browser/render_process_host.h" 84 #include "content/public/browser/render_process_host.h"
86 #include "content/public/common/url_fetcher.h" 85 #include "content/public/common/url_fetcher.h"
87 #include "ipc/ipc_logging.h"
88 #include "net/socket/client_socket_pool_manager.h" 86 #include "net/socket/client_socket_pool_manager.h"
89 #include "net/url_request/url_request_context_getter.h" 87 #include "net/url_request/url_request_context_getter.h"
90 #include "ui/base/clipboard/clipboard.h" 88 #include "ui/base/clipboard/clipboard.h"
91 #include "ui/base/l10n/l10n_util.h" 89 #include "ui/base/l10n/l10n_util.h"
92 90
93 #if defined(OS_WIN) 91 #if defined(OS_WIN)
94 #include "views/focus/view_storage.h" 92 #include "views/focus/view_storage.h"
95 #elif defined(OS_MACOSX) 93 #elif defined(OS_MACOSX)
96 #include "chrome/browser/chrome_browser_main_mac.h" 94 #include "chrome/browser/chrome_browser_main_mac.h"
97 #endif 95 #endif
98 96
99 #if defined(IPC_MESSAGE_LOG_ENABLED)
100 #include "content/common/child_process_messages.h"
101 #endif
102
103 #if defined(OS_CHROMEOS) 97 #if defined(OS_CHROMEOS)
104 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" 98 #include "chrome/browser/chromeos/web_socket_proxy_controller.h"
105 #include "chrome/browser/oom_priority_manager.h" 99 #include "chrome/browser/oom_priority_manager.h"
106 #endif // defined(OS_CHROMEOS) 100 #endif // defined(OS_CHROMEOS)
107 101
108 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 102 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
109 // How often to check if the persistent instance of Chrome needs to restart 103 // How often to check if the persistent instance of Chrome needs to restart
110 // to install an update. 104 // to install an update.
111 static const int kUpdateCheckIntervalHours = 6; 105 static const int kUpdateCheckIntervalHours = 6;
112 #endif 106 #endif
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); 1045 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL);
1052 set_browser_worker->StartSetAsDefault(); 1046 set_browser_worker->StartSetAsDefault();
1053 } 1047 }
1054 } 1048 }
1055 1049
1056 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { 1050 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() {
1057 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); 1051 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt);
1058 resource_dispatcher_host()->set_allow_cross_origin_auth_prompt(value); 1052 resource_dispatcher_host()->set_allow_cross_origin_auth_prompt(value);
1059 } 1053 }
1060 1054
1061 // The BrowserProcess object must outlive the file thread so we use traits
1062 // which don't do any management.
1063 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl);
1064
1065 #if defined(IPC_MESSAGE_LOG_ENABLED)
1066
1067 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) {
1068 // First enable myself.
1069 if (enable)
1070 IPC::Logging::GetInstance()->Enable();
1071 else
1072 IPC::Logging::GetInstance()->Disable();
1073
1074 // Now tell subprocesses. Messages to ChildProcess-derived
1075 // processes must be done on the IO thread.
1076 io_thread()->message_loop()->PostTask
1077 (FROM_HERE,
1078 NewRunnableMethod(
1079 this,
1080 &BrowserProcessImpl::SetIPCLoggingEnabledForChildProcesses,
1081 enable));
1082
1083 // Finally, tell the renderers which don't derive from ChildProcess.
1084 // Messages to the renderers must be done on the UI (main) thread.
1085 for (content::RenderProcessHost::iterator i(
1086 content::RenderProcessHost::AllHostsIterator());
1087 !i.IsAtEnd(); i.Advance())
1088 i.GetCurrentValue()->Send(new ChildProcessMsg_SetIPCLoggingEnabled(enable));
1089 }
1090
1091 // Helper for SetIPCLoggingEnabled.
1092 void BrowserProcessImpl::SetIPCLoggingEnabledForChildProcesses(bool enabled) {
1093 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1094
1095 BrowserChildProcessHost::Iterator i; // default constr references a singleton
1096 while (!i.Done()) {
1097 i->Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled));
1098 ++i;
1099 }
1100 }
1101
1102 #endif // IPC_MESSAGE_LOG_ENABLED
1103
1104 // Mac is currently not supported. 1055 // Mac is currently not supported.
1105 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1056 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
1106 1057
1107 bool BrowserProcessImpl::CanAutorestartForUpdate() const { 1058 bool BrowserProcessImpl::CanAutorestartForUpdate() const {
1108 // Check if browser is in the background and if it needs to be restarted to 1059 // Check if browser is in the background and if it needs to be restarted to
1109 // apply a pending update. 1060 // apply a pending update.
1110 return BrowserList::size() == 0 && BrowserList::WillKeepAlive() && 1061 return BrowserList::size() == 0 && BrowserList::WillKeepAlive() &&
1111 upgrade_util::IsUpdatePendingRestart(); 1062 upgrade_util::IsUpdatePendingRestart();
1112 } 1063 }
1113 1064
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 } 1102 }
1152 1103
1153 void BrowserProcessImpl::OnAutoupdateTimer() { 1104 void BrowserProcessImpl::OnAutoupdateTimer() {
1154 if (CanAutorestartForUpdate()) { 1105 if (CanAutorestartForUpdate()) {
1155 DLOG(WARNING) << "Detected update. Restarting browser."; 1106 DLOG(WARNING) << "Detected update. Restarting browser.";
1156 RestartBackgroundInstance(); 1107 RestartBackgroundInstance();
1157 } 1108 }
1158 } 1109 }
1159 1110
1160 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1111 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/browser/ui/cocoa/about_ipc_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698