OLD | NEW |
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/renderer/chrome_render_process_observer.h" | 5 #include "chrome/renderer/chrome_render_process_observer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/net/net_resource_provider.h" |
14 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
15 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
16 #include "content/renderer/render_thread.h" | 17 #include "content/renderer/render_thread.h" |
17 #include "content/renderer/render_view.h" | 18 #include "content/renderer/render_view.h" |
18 #include "content/renderer/render_view_visitor.h" | 19 #include "content/renderer/render_view_visitor.h" |
19 #include "crypto/nss_util.h" | 20 #include "crypto/nss_util.h" |
| 21 #include "net/base/net_module.h" |
20 #include "third_party/sqlite/sqlite3.h" | 22 #include "third_party/sqlite/sqlite3.h" |
21 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" | 23 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCrossOriginPreflig
htResultCache.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCrossOriginPreflig
htResultCache.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFontCache.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFontCache.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
27 #include "v8/include/v8.h" | 29 #include "v8/include/v8.h" |
28 | |
29 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
30 #include "app/win/iat_patch_function.h" | 31 #include "app/win/iat_patch_function.h" |
31 #endif | 32 #endif |
32 | 33 |
33 using WebKit::WebCache; | 34 using WebKit::WebCache; |
34 using WebKit::WebCrossOriginPreflightResultCache; | 35 using WebKit::WebCrossOriginPreflightResultCache; |
35 using WebKit::WebFontCache; | 36 using WebKit::WebFontCache; |
36 | 37 |
37 namespace { | 38 namespace { |
38 | 39 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 104 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
104 | 105 |
105 if (command_line.HasSwitch(switches::kEnableWatchdog)) { | 106 if (command_line.HasSwitch(switches::kEnableWatchdog)) { |
106 // TODO(JAR): Need to implement renderer IO msgloop watchdog. | 107 // TODO(JAR): Need to implement renderer IO msgloop watchdog. |
107 } | 108 } |
108 | 109 |
109 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { | 110 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { |
110 base::StatisticsRecorder::set_dump_on_exit(true); | 111 base::StatisticsRecorder::set_dump_on_exit(true); |
111 } | 112 } |
112 | 113 |
| 114 // Configure modules that need access to resources. |
| 115 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
| 116 |
113 #if defined(OS_WIN) | 117 #if defined(OS_WIN) |
114 // Need to patch a few functions for font loading to work correctly. | 118 // Need to patch a few functions for font loading to work correctly. |
115 FilePath pdf; | 119 FilePath pdf; |
116 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && | 120 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && |
117 file_util::PathExists(pdf)) { | 121 file_util::PathExists(pdf)) { |
118 g_iat_patch_createdca.Patch( | 122 g_iat_patch_createdca.Patch( |
119 pdf.value().c_str(), "gdi32.dll", "CreateDCA", CreateDCAPatch); | 123 pdf.value().c_str(), "gdi32.dll", "CreateDCA", CreateDCAPatch); |
120 g_iat_patch_get_font_data.Patch( | 124 g_iat_patch_get_font_data.Patch( |
121 pdf.value().c_str(), "gdi32.dll", "GetFontData", GetFontDataPatch); | 125 pdf.value().c_str(), "gdi32.dll", "GetFontData", GetFontDataPatch); |
122 } | 126 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // a new "delete everything" pass because object references make it difficult | 235 // a new "delete everything" pass because object references make it difficult |
232 // to free everything possible in just one pass. | 236 // to free everything possible in just one pass. |
233 while (!v8::V8::IdleNotification()) { | 237 while (!v8::V8::IdleNotification()) { |
234 } | 238 } |
235 | 239 |
236 #if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) | 240 #if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) |
237 // Tell tcmalloc to release any free pages it's still holding. | 241 // Tell tcmalloc to release any free pages it's still holding. |
238 MallocExtension::instance()->ReleaseFreeMemory(); | 242 MallocExtension::instance()->ReleaseFreeMemory(); |
239 #endif | 243 #endif |
240 } | 244 } |
OLD | NEW |