| 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/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/native_library.h" | 11 #include "base/native_library.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
| 15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/extensions/extension_localization_peer.h" | 17 #include "chrome/common/extensions/extension_localization_peer.h" |
| 18 #include "chrome/common/net/net_resource_provider.h" | 18 #include "chrome/common/net/net_resource_provider.h" |
| 19 #include "chrome/common/render_messages.h" | 19 #include "chrome/common/render_messages.h" |
| 20 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 20 #include "chrome/renderer/content_settings_observer.h" | 21 #include "chrome/renderer/content_settings_observer.h" |
| 21 #include "chrome/renderer/security_filter_peer.h" | 22 #include "chrome/renderer/security_filter_peer.h" |
| 22 #include "content/common/resource_dispatcher.h" | 23 #include "content/common/resource_dispatcher.h" |
| 23 #include "content/common/resource_dispatcher_delegate.h" | 24 #include "content/common/resource_dispatcher_delegate.h" |
| 24 #include "content/common/view_messages.h" | 25 #include "content/common/view_messages.h" |
| 25 #include "content/renderer/render_thread.h" | 26 #include "content/renderer/render_thread.h" |
| 26 #include "content/renderer/render_view.h" | 27 #include "content/renderer/render_view.h" |
| 27 #include "content/renderer/render_view_visitor.h" | 28 #include "content/renderer/render_view_visitor.h" |
| 28 #include "crypto/nss_util.h" | 29 #include "crypto/nss_util.h" |
| 29 #include "media/base/media.h" | 30 #include "media/base/media.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 const int shutdown_fd_; | 299 const int shutdown_fd_; |
| 299 | 300 |
| 300 DISALLOW_COPY_AND_ASSIGN(ShutdownDetector); | 301 DISALLOW_COPY_AND_ASSIGN(ShutdownDetector); |
| 301 }; | 302 }; |
| 302 #endif // OS_MACOSX | 303 #endif // OS_MACOSX |
| 303 | 304 |
| 304 } // namespace | 305 } // namespace |
| 305 | 306 |
| 306 bool ChromeRenderProcessObserver::is_incognito_process_ = false; | 307 bool ChromeRenderProcessObserver::is_incognito_process_ = false; |
| 307 | 308 |
| 308 ChromeRenderProcessObserver::ChromeRenderProcessObserver() { | 309 ChromeRenderProcessObserver::ChromeRenderProcessObserver( |
| 310 chrome::ChromeContentRendererClient* client) |
| 311 : client_(client) { |
| 309 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 312 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 310 if (command_line.HasSwitch(switches::kEnableWatchdog)) { | 313 if (command_line.HasSwitch(switches::kEnableWatchdog)) { |
| 311 // TODO(JAR): Need to implement renderer IO msgloop watchdog. | 314 // TODO(JAR): Need to implement renderer IO msgloop watchdog. |
| 312 } | 315 } |
| 313 | 316 |
| 314 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { | 317 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { |
| 315 base::StatisticsRecorder::set_dump_on_exit(true); | 318 base::StatisticsRecorder::set_dump_on_exit(true); |
| 316 } | 319 } |
| 317 | 320 |
| 318 RenderThread* thread = RenderThread::current(); | 321 RenderThread* thread = RenderThread::current(); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 // more to free"). Note that it makes more sense to do this than to implement | 498 // more to free"). Note that it makes more sense to do this than to implement |
| 496 // a new "delete everything" pass because object references make it difficult | 499 // a new "delete everything" pass because object references make it difficult |
| 497 // to free everything possible in just one pass. | 500 // to free everything possible in just one pass. |
| 498 while (!v8::V8::IdleNotification()) { | 501 while (!v8::V8::IdleNotification()) { |
| 499 } | 502 } |
| 500 | 503 |
| 501 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | 504 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) |
| 502 // Tell tcmalloc to release any free pages it's still holding. | 505 // Tell tcmalloc to release any free pages it's still holding. |
| 503 MallocExtension::instance()->ReleaseFreeMemory(); | 506 MallocExtension::instance()->ReleaseFreeMemory(); |
| 504 #endif | 507 #endif |
| 508 |
| 509 if (client_) |
| 510 client_->OnPurgeMemory(); |
| 505 } | 511 } |
| OLD | NEW |