OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/render_thread.h" | 5 #include "chrome/renderer/render_thread.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "chrome/renderer/user_script_slave.h" | 43 #include "chrome/renderer/user_script_slave.h" |
44 #include "ipc/ipc_message.h" | 44 #include "ipc/ipc_message.h" |
45 #include "webkit/api/public/WebColor.h" | 45 #include "webkit/api/public/WebColor.h" |
46 #include "webkit/api/public/WebCache.h" | 46 #include "webkit/api/public/WebCache.h" |
47 #include "webkit/api/public/WebKit.h" | 47 #include "webkit/api/public/WebKit.h" |
48 #include "webkit/api/public/WebString.h" | 48 #include "webkit/api/public/WebString.h" |
49 #include "webkit/extensions/v8/benchmarking_extension.h" | 49 #include "webkit/extensions/v8/benchmarking_extension.h" |
50 #include "webkit/extensions/v8/gears_extension.h" | 50 #include "webkit/extensions/v8/gears_extension.h" |
51 #include "webkit/extensions/v8/interval_extension.h" | 51 #include "webkit/extensions/v8/interval_extension.h" |
52 #include "webkit/extensions/v8/playback_extension.h" | 52 #include "webkit/extensions/v8/playback_extension.h" |
53 #include "third_party/tcmalloc/google/malloc_extension.h" | 53 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" |
54 | 54 |
55 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
56 #include <windows.h> | 56 #include <windows.h> |
57 #include <objbase.h> | 57 #include <objbase.h> |
58 #endif | 58 #endif |
59 | 59 |
60 using WebKit::WebCache; | 60 using WebKit::WebCache; |
61 using WebKit::WebString; | 61 using WebKit::WebString; |
62 | 62 |
63 namespace { | 63 namespace { |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 WebKit::enableMediaPlayer(); | 460 WebKit::enableMediaPlayer(); |
461 } | 461 } |
462 | 462 |
463 void RenderThread::IdleHandler() { | 463 void RenderThread::IdleHandler() { |
464 // It is possible that the timer was set while the widgets were idle, | 464 // It is possible that the timer was set while the widgets were idle, |
465 // but that they are no longer idle. If so, just return. | 465 // but that they are no longer idle. If so, just return. |
466 if (!widget_count_ || hidden_widget_count_ < widget_count_) | 466 if (!widget_count_ || hidden_widget_count_ < widget_count_) |
467 return; | 467 return; |
468 | 468 |
469 #if defined(OS_WIN) | 469 #if defined(OS_WIN) |
470 MallocExtension::instance()->Scavenge(); | 470 MallocExtension::instance()->ReleaseFreeMemory(); |
471 #endif | 471 #endif |
472 | 472 |
473 if (!v8::V8::IsDead()) { | 473 if (!v8::V8::IsDead()) { |
474 LOG(INFO) << "RenderThread calling v8 IdleNotification for " << this; | 474 LOG(INFO) << "RenderThread calling v8 IdleNotification for " << this; |
475 v8::V8::IdleNotification(false); | 475 v8::V8::IdleNotification(false); |
476 } | 476 } |
477 | 477 |
478 // Schedule next invocation. | 478 // Schedule next invocation. |
479 // Dampen the delay using the algorithm: | 479 // Dampen the delay using the algorithm: |
480 // delay = delay + 1 / (delay + 2) | 480 // delay = delay + 1 / (delay + 2) |
(...skipping 17 matching lines...) Expand all Loading... |
498 | 498 |
499 void RenderThread::OnPurgePluginListCache(bool reload_pages) { | 499 void RenderThread::OnPurgePluginListCache(bool reload_pages) { |
500 // The call below will cause a GetPlugins call with refresh=true, but at this | 500 // The call below will cause a GetPlugins call with refresh=true, but at this |
501 // point we already know that the browser has refreshed its list, so disable | 501 // point we already know that the browser has refreshed its list, so disable |
502 // refresh temporarily to prevent each renderer process causing the list to be | 502 // refresh temporarily to prevent each renderer process causing the list to be |
503 // regenerated. | 503 // regenerated. |
504 plugin_refresh_allowed_ = false; | 504 plugin_refresh_allowed_ = false; |
505 WebKit::resetPluginCache(reload_pages); | 505 WebKit::resetPluginCache(reload_pages); |
506 plugin_refresh_allowed_ = true; | 506 plugin_refresh_allowed_ = true; |
507 } | 507 } |
OLD | NEW |