summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-19 06:27:47 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-19 06:27:47 +0000
commit2c434b3ebbf5deb5f225ac375da9be89c9683c76 (patch)
treefe7adcb3f446417bed170d3334a2423d2072db21 /chrome
parent2d24533e33dca38c64e2a4ec2480eb59b6ef34b6 (diff)
downloadchromium_src-2c434b3ebbf5deb5f225ac375da9be89c9683c76.zip
chromium_src-2c434b3ebbf5deb5f225ac375da9be89c9683c76.tar.gz
chromium_src-2c434b3ebbf5deb5f225ac375da9be89c9683c76.tar.bz2
Chrome-side of moving webkit/glue/cache_manager.{h,cc} to the WebKit API layer.
This also includes a change to not have third_party/WebKit/WebKit/chromium/public in the global include path. Most of the code changes pertain to this. I also took this opportunity to do some renaming: browser/cache_manager_host -> browser/renderer_host/web_cache_manager R=brettw Review URL: http://codereview.chromium.org/42194 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.scons2
-rw-r--r--chrome/browser/browser.vcproj16
-rw-r--r--chrome/browser/browser_prefs.cc4
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc12
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h4
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc8
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h4
-rw-r--r--chrome/browser/renderer_host/web_cache_manager.cc (renamed from chrome/browser/cache_manager_host.cc)89
-rw-r--r--chrome/browser/renderer_host/web_cache_manager.h (renamed from chrome/browser/cache_manager_host.h)41
-rw-r--r--chrome/browser/renderer_host/web_cache_manager_unittest.cc (renamed from chrome/browser/cache_manager_host_unittest.cc)136
-rw-r--r--chrome/browser/tab_contents/web_contents.cc4
-rw-r--r--chrome/browser/task_manager.h2
-rw-r--r--chrome/chrome.gyp6
-rw-r--r--chrome/common/ipc_message_utils.h54
-rw-r--r--chrome/common/render_messages.h80
-rw-r--r--chrome/common/render_messages_internal.h4
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc1
-rw-r--r--chrome/common/temp_scaffolding_stubs.h1
-rw-r--r--chrome/renderer/render_thread.cc24
-rw-r--r--chrome/renderer/render_view_unittest.cc3
-rw-r--r--chrome/renderer/renderer_glue.cc13
-rw-r--r--chrome/renderer/renderer_webkitclient_impl.cc5
-rw-r--r--chrome/renderer/renderer_webkitclient_impl.h2
-rw-r--r--chrome/test/unit/unit_tests.scons2
-rw-r--r--chrome/test/unit/unittests.vcproj8
-rw-r--r--chrome/worker/worker_thread.cc3
-rw-r--r--chrome/worker/worker_webkitclient_impl.cc4
27 files changed, 266 insertions, 266 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons
index 222f1e6..4d51802a 100644
--- a/chrome/browser/browser.scons
+++ b/chrome/browser/browser.scons
@@ -96,7 +96,6 @@ input_files = ChromeFileList([
'browsing_data_remover.h',
'browsing_instance.cc',
'browsing_instance.h',
- 'cache_manager_host.cc',
'cache_manager_host.h',
'cancelable_request.cc',
'cancelable_request.h',
@@ -568,6 +567,7 @@ input_files = ChromeFileList([
'renderer_host/save_file_resource_handler.h',
'renderer_host/sync_resource_handler.cc',
'renderer_host/sync_resource_handler.h',
+ 'renderer_host/web_cache_manager.cc',
]),
MSVSFilter('Tab Contents', [
'tab_contents/constrained_window.h',
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj
index 2d792bf..5c80c9e 100644
--- a/chrome/browser/browser.vcproj
+++ b/chrome/browser/browser.vcproj
@@ -314,14 +314,6 @@
>
</File>
<File
- RelativePath=".\cache_manager_host.cc"
- >
- </File>
- <File
- RelativePath=".\cache_manager_host.h"
- >
- </File>
- <File
RelativePath=".\cancelable_request.cc"
>
</File>
@@ -2157,6 +2149,14 @@
RelativePath=".\renderer_host\sync_resource_handler.h"
>
</File>
+ <File
+ RelativePath=".\renderer_host\web_cache_manager.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\renderer_host\web_cache_manager.h"
+ >
+ </File>
</Filter>
<Filter
Name="Tab Contents"
diff --git a/chrome/browser/browser_prefs.cc b/chrome/browser/browser_prefs.cc
index 570763f..7e9d6d8 100644
--- a/chrome/browser/browser_prefs.cc
+++ b/chrome/browser/browser_prefs.cc
@@ -8,7 +8,6 @@
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_shutdown.h"
-#include "chrome/browser/cache_manager_host.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/external_protocol_handler.h"
#include "chrome/browser/google_url_tracker.h"
@@ -16,6 +15,7 @@
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/password_manager/password_manager.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
+#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
#include "chrome/browser/session_startup_pref.h"
@@ -35,7 +35,7 @@ namespace browser {
void RegisterAllPrefs(PrefService* user_prefs, PrefService* local_state) {
// Prefs in Local State
Browser::RegisterPrefs(local_state);
- CacheManagerHost::RegisterPrefs(local_state);
+ WebCacheManager::RegisterPrefs(local_state);
ExternalProtocolHandler::RegisterPrefs(local_state);
GoogleURLTracker::RegisterPrefs(local_state);
MetricsLog::RegisterPrefs(local_state);
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 810ec1d..c694fdd 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -23,7 +23,6 @@
#include "base/string_util.h"
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/cache_manager_host.h"
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/plugin_service.h"
@@ -31,6 +30,7 @@
#include "chrome/browser/renderer_host/render_widget_helper.h"
#include "chrome/browser/renderer_host/renderer_security_policy.h"
#include "chrome/browser/renderer_host/resource_message_filter.h"
+#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "chrome/browser/visitedlink_master.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/child_process_info.h"
@@ -44,6 +44,8 @@
#include "chrome/renderer/render_process.h"
#include "grit/generated_resources.h"
+using WebKit::WebCache;
+
#if defined(OS_WIN)
// TODO(port): see comment by the only usage of RenderViewHost in this file.
@@ -153,7 +155,7 @@ BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile)
BrowserRenderProcessHost::~BrowserRenderProcessHost() {
if (pid() >= 0) {
- CacheManagerHost::GetInstance()->Remove(pid());
+ WebCacheManager::GetInstance()->Remove(pid());
RendererSecurityPolicy::GetInstance()->Remove(pid());
}
@@ -335,7 +337,7 @@ bool BrowserRenderProcessHost::Init() {
}
resource_message_filter->Init(pid());
- CacheManagerHost::GetInstance()->Add(pid());
+ WebCacheManager::GetInstance()->Add(pid());
RendererSecurityPolicy::GetInstance()->Add(pid());
// Now that the process is created, set it's backgrounding accordingly.
@@ -697,8 +699,8 @@ void BrowserRenderProcessHost::OnPageContents(const GURL& url,
}
void BrowserRenderProcessHost::OnUpdatedCacheStats(
- const CacheManager::UsageStats& stats) {
- CacheManagerHost::GetInstance()->ObserveStats(pid(), stats);
+ const WebCache::UsageStats& stats) {
+ WebCacheManager::GetInstance()->ObserveStats(pid(), stats);
}
void BrowserRenderProcessHost::SetBackgrounded(bool backgrounded) {
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index 3cc05a8..d6f821e 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -19,7 +19,7 @@
#include "chrome/browser/renderer_host/audio_renderer_host.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/common/notification_observer.h"
-#include "webkit/glue/cache_manager.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
class CommandLine;
class GURL;
@@ -99,7 +99,7 @@ class BrowserRenderProcessHost : public RenderProcessHost,
void OnClipboardReadAsciiText(std::string* result);
void OnClipboardReadHTML(string16* markup, GURL* src_url);
- void OnUpdatedCacheStats(const CacheManager::UsageStats& stats);
+ void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats);
// Initialize support for visited links. Send the renderer process its initial
// set of visited links.
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 2ea6ac8..377bfc7 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -41,6 +41,8 @@
#include "chrome/common/temp_scaffolding_stubs.h"
#endif
+using WebKit::WebCache;
+
namespace {
// Context menus are somewhat complicated. We need to intercept them here on
@@ -555,15 +557,15 @@ void ResourceMessageFilter::OnDuplicateSection(
}
void ResourceMessageFilter::OnResourceTypeStats(
- const CacheManager::ResourceTypeStats& stats) {
+ const WebCache::ResourceTypeStats& stats) {
HISTOGRAM_COUNTS("WebCoreCache.ImagesSizeKB",
static_cast<int>(stats.images.size / 1024));
HISTOGRAM_COUNTS("WebCoreCache.CSSStylesheetsSizeKB",
- static_cast<int>(stats.css_stylesheets.size / 1024));
+ static_cast<int>(stats.cssStyleSheets.size / 1024));
HISTOGRAM_COUNTS("WebCoreCache.ScriptsSizeKB",
static_cast<int>(stats.scripts.size / 1024));
HISTOGRAM_COUNTS("WebCoreCache.XSLStylesheetsSizeKB",
- static_cast<int>(stats.xsl_stylesheets.size / 1024));
+ static_cast<int>(stats.xslStyleSheets.size / 1024));
HISTOGRAM_COUNTS("WebCoreCache.FontsSizeKB",
static_cast<int>(stats.fonts.size / 1024));
}
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index 7f05d85..29ae829 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -22,7 +22,7 @@
#include "chrome/common/modal_dialog_event.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/transport_dib.h"
-#include "webkit/glue/cache_manager.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
#if defined(OS_WIN)
#include <windows.h>
@@ -164,7 +164,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
void OnGetCPBrowsingContext(uint32* context);
void OnDuplicateSection(base::SharedMemoryHandle renderer_handle,
base::SharedMemoryHandle* browser_handle);
- void OnResourceTypeStats(const CacheManager::ResourceTypeStats& stats);
+ void OnResourceTypeStats(const WebKit::WebCache::ResourceTypeStats& stats);
void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
diff --git a/chrome/browser/cache_manager_host.cc b/chrome/browser/renderer_host/web_cache_manager.cc
index da6ec4c..91b740e 100644
--- a/chrome/browser/cache_manager_host.cc
+++ b/chrome/browser/renderer_host/web_cache_manager.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/cache_manager_host.h"
+#include "chrome/browser/renderer_host/web_cache_manager.h"
#include <algorithm>
@@ -19,6 +19,7 @@
using base::Time;
using base::TimeDelta;
+using WebKit::WebCache;
static const unsigned int kReviseAllocationDelayMS = 200 /* milliseconds */;
@@ -44,24 +45,24 @@ int GetDefaultCacheSize() {
} // anonymous namespace
// static
-void CacheManagerHost::RegisterPrefs(PrefService* prefs) {
+void WebCacheManager::RegisterPrefs(PrefService* prefs) {
prefs->RegisterIntegerPref(prefs::kMemoryCacheSize, GetDefaultCacheSize());
}
// static
-CacheManagerHost* CacheManagerHost::GetInstance() {
- return Singleton<CacheManagerHost>::get();
+WebCacheManager* WebCacheManager::GetInstance() {
+ return Singleton<WebCacheManager>::get();
}
-CacheManagerHost::CacheManagerHost()
+WebCacheManager::WebCacheManager()
: global_size_limit_(GetDefaultGlobalSizeLimit()),
ALLOW_THIS_IN_INITIALIZER_LIST(revise_allocation_factory_(this)) {
}
-CacheManagerHost::~CacheManagerHost() {
+WebCacheManager::~WebCacheManager() {
}
-void CacheManagerHost::Add(int renderer_id) {
+void WebCacheManager::Add(int renderer_id) {
DCHECK(inactive_renderers_.count(renderer_id) == 0);
// It is tempting to make the following DCHECK here, but it fails when a new
@@ -83,7 +84,7 @@ void CacheManagerHost::Add(int renderer_id) {
ReviseAllocationStrategyLater();
}
-void CacheManagerHost::Remove(int renderer_id) {
+void WebCacheManager::Remove(int renderer_id) {
DCHECK(active_renderers_.count(renderer_id) > 0 ||
inactive_renderers_.count(renderer_id) > 0);
@@ -96,7 +97,7 @@ void CacheManagerHost::Remove(int renderer_id) {
ReviseAllocationStrategyLater();
}
-void CacheManagerHost::ObserveActivity(int renderer_id) {
+void WebCacheManager::ObserveActivity(int renderer_id) {
// Record activity.
active_renderers_.insert(renderer_id);
@@ -115,36 +116,36 @@ void CacheManagerHost::ObserveActivity(int renderer_id) {
}
}
-void CacheManagerHost::ObserveStats(int renderer_id,
- const CacheManager::UsageStats& stats) {
+void WebCacheManager::ObserveStats(int renderer_id,
+ const WebCache::UsageStats& stats) {
StatsMap::iterator entry = stats_.find(renderer_id);
if (entry == stats_.end())
return; // We might see stats for a renderer that has been destroyed.
// Record the updated stats.
entry->second.capacity = stats.capacity;
- entry->second.dead_size = stats.dead_size;
- entry->second.live_size = stats.live_size;
- entry->second.max_dead_capacity = stats.max_dead_capacity;
- entry->second.min_dead_capacity = stats.min_dead_capacity;
+ entry->second.deadSize = stats.deadSize;
+ entry->second.liveSize = stats.liveSize;
+ entry->second.maxDeadCapacity = stats.maxDeadCapacity;
+ entry->second.minDeadCapacity = stats.minDeadCapacity;
// trigger notification
- CacheManager::UsageStats stats_details(stats);
+ WebCache::UsageStats stats_details(stats);
// &stats_details is only valid during the notification.
// See notification_types.h.
NotificationService::current()->Notify(
NotificationType::WEB_CACHE_STATS_OBSERVED,
Source<RenderProcessHost>(RenderProcessHost::FromID(renderer_id)),
- Details<CacheManager::UsageStats>(&stats_details));
+ Details<WebCache::UsageStats>(&stats_details));
}
-void CacheManagerHost::SetGlobalSizeLimit(size_t bytes) {
+void WebCacheManager::SetGlobalSizeLimit(size_t bytes) {
global_size_limit_ = bytes;
ReviseAllocationStrategyLater();
}
// static
-size_t CacheManagerHost::GetDefaultGlobalSizeLimit() {
+size_t WebCacheManager::GetDefaultGlobalSizeLimit() {
PrefService* perf_service = g_browser_process->local_state();
if (perf_service)
return perf_service->GetInteger(prefs::kMemoryCacheSize);
@@ -152,29 +153,29 @@ size_t CacheManagerHost::GetDefaultGlobalSizeLimit() {
return GetDefaultCacheSize();
}
-void CacheManagerHost::GatherStats(const std::set<int>& renderers,
- CacheManager::UsageStats* stats) {
+void WebCacheManager::GatherStats(const std::set<int>& renderers,
+ WebCache::UsageStats* stats) {
DCHECK(stats);
- memset(stats, 0, sizeof(CacheManager::UsageStats));
+ memset(stats, 0, sizeof(WebCache::UsageStats));
std::set<int>::const_iterator iter = renderers.begin();
while (iter != renderers.end()) {
StatsMap::iterator elmt = stats_.find(*iter);
if (elmt != stats_.end()) {
- stats->min_dead_capacity += elmt->second.min_dead_capacity;
- stats->max_dead_capacity += elmt->second.max_dead_capacity;
+ stats->minDeadCapacity += elmt->second.minDeadCapacity;
+ stats->maxDeadCapacity += elmt->second.maxDeadCapacity;
stats->capacity += elmt->second.capacity;
- stats->live_size += elmt->second.live_size;
- stats->dead_size += elmt->second.dead_size;
+ stats->liveSize += elmt->second.liveSize;
+ stats->deadSize += elmt->second.deadSize;
}
++iter;
}
}
// static
-size_t CacheManagerHost::GetSize(AllocationTactic tactic,
- const CacheManager::UsageStats& stats) {
+size_t WebCacheManager::GetSize(AllocationTactic tactic,
+ const WebCache::UsageStats& stats) {
switch (tactic) {
case DIVIDE_EVENLY:
// We aren't going to reserve any space for existing objects.
@@ -184,24 +185,24 @@ size_t CacheManagerHost::GetSize(AllocationTactic tactic,
return 3 * GetSize(KEEP_CURRENT, stats) / 2;
case KEEP_CURRENT:
// We need enough space to keep our current objects.
- return stats.live_size + stats.dead_size;
+ return stats.liveSize + stats.deadSize;
case KEEP_LIVE_WITH_HEADROOM:
// We need enough space to keep out live resources, plus some headroom.
return 3 * GetSize(KEEP_LIVE, stats) / 2;
case KEEP_LIVE:
// We need enough space to keep our live resources.
- return stats.live_size;
+ return stats.liveSize;
default:
NOTREACHED() << "Unknown cache allocation tactic";
return 0;
}
}
-bool CacheManagerHost::AttemptTactic(
+bool WebCacheManager::AttemptTactic(
AllocationTactic active_tactic,
- const CacheManager::UsageStats& active_stats,
+ const WebCache::UsageStats& active_stats,
AllocationTactic inactive_tactic,
- const CacheManager::UsageStats& inactive_stats,
+ const WebCache::UsageStats& inactive_stats,
AllocationStrategy* strategy) {
DCHECK(strategy);
@@ -238,10 +239,10 @@ bool CacheManagerHost::AttemptTactic(
return true;
}
-void CacheManagerHost::AddToStrategy(std::set<int> renderers,
- AllocationTactic tactic,
- size_t extra_bytes_to_allocate,
- AllocationStrategy* strategy) {
+void WebCacheManager::AddToStrategy(std::set<int> renderers,
+ AllocationTactic tactic,
+ size_t extra_bytes_to_allocate,
+ AllocationStrategy* strategy) {
DCHECK(strategy);
// Nothing to do if there are no renderers. It is common for there to be no
@@ -267,7 +268,7 @@ void CacheManagerHost::AddToStrategy(std::set<int> renderers,
}
}
-void CacheManagerHost::EnactStrategy(const AllocationStrategy& strategy) {
+void WebCacheManager::EnactStrategy(const AllocationStrategy& strategy) {
// Inform each render process of its cache allocation.
AllocationStrategy::const_iterator allocation = strategy.begin();
while (allocation != strategy.end()) {
@@ -294,7 +295,7 @@ void CacheManagerHost::EnactStrategy(const AllocationStrategy& strategy) {
}
}
-void CacheManagerHost::ReviseAllocationStrategy() {
+void WebCacheManager::ReviseAllocationStrategy() {
DCHECK(stats_.size() <=
active_renderers_.size() + inactive_renderers_.size());
@@ -302,8 +303,8 @@ void CacheManagerHost::ReviseAllocationStrategy() {
FindInactiveRenderers();
// Gather statistics
- CacheManager::UsageStats active;
- CacheManager::UsageStats inactive;
+ WebCache::UsageStats active;
+ WebCache::UsageStats inactive;
GatherStats(active_renderers_, &active);
GatherStats(inactive_renderers_, &inactive);
@@ -349,16 +350,16 @@ void CacheManagerHost::ReviseAllocationStrategy() {
}
}
-void CacheManagerHost::ReviseAllocationStrategyLater() {
+void WebCacheManager::ReviseAllocationStrategyLater() {
// Ask to be called back in a few milliseconds to actually recompute our
// allocation.
MessageLoop::current()->PostDelayedTask(FROM_HERE,
revise_allocation_factory_.NewRunnableMethod(
- &CacheManagerHost::ReviseAllocationStrategy),
+ &WebCacheManager::ReviseAllocationStrategy),
kReviseAllocationDelayMS);
}
-void CacheManagerHost::FindInactiveRenderers() {
+void WebCacheManager::FindInactiveRenderers() {
std::set<int>::const_iterator iter = active_renderers_.begin();
while (iter != active_renderers_.end()) {
StatsMap::iterator elmt = stats_.find(*iter);
diff --git a/chrome/browser/cache_manager_host.h b/chrome/browser/renderer_host/web_cache_manager.h
index f1313dc..1e9b642 100644
--- a/chrome/browser/cache_manager_host.h
+++ b/chrome/browser/renderer_host/web_cache_manager.h
@@ -5,8 +5,8 @@
// This is the browser side of the cache manager, it tracks the activity of the
// render processes and allocates available memory cache resources.
-#ifndef CHROME_BROWSER_CACHE_MANAGER_HOST_H__
-#define CHROME_BROWSER_CACHE_MANAGER_HOST_H__
+#ifndef CHROME_BROWSER_WEB_CACHE_MANAGER_H_
+#define CHROME_BROWSER_WEB_CACHE_MANAGER_H_
#include <map>
#include <list>
@@ -17,21 +17,21 @@
#include "base/singleton.h"
#include "base/task.h"
#include "base/time.h"
-#include "webkit/glue/cache_manager.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
class PrefService;
-class CacheManagerHost {
+class WebCacheManager {
// Unit tests are our friends.
- friend class CacheManagerHostTest;
+ friend class WebCacheManagerTest;
public:
static void RegisterPrefs(PrefService* prefs);
- // Gets the singleton CacheManagerHost object. The first time this method
- // is called, a CacheManagerHost object is constructed and returned.
+ // Gets the singleton WebCacheManager object. The first time this method
+ // is called, a WebCacheManager object is constructed and returned.
// Subsequent calls will return the same object.
- static CacheManagerHost* GetInstance();
+ static WebCacheManager* GetInstance();
// When a render process is created, it registers itself with the cache
// manager host, causing the renderer to be allocated cache resources.
@@ -53,7 +53,8 @@ class CacheManagerHost {
// Periodically, renderers should inform the cache manager of their current
// statistics. The more up-to-date the cache manager's statistics, the
// better it can allocate cache resources.
- void ObserveStats(int renderer_id, const CacheManager::UsageStats& stats);
+ void ObserveStats(
+ int renderer_id, const WebKit::WebCache::UsageStats& stats);
// The global limit on the number of bytes in all the in-memory caches.
size_t global_size_limit() const { return global_size_limit_; }
@@ -70,7 +71,7 @@ class CacheManagerHost {
static const int kRendererInactiveThresholdMinutes = 5;
// Keep track of some renderer information.
- struct RendererInfo : CacheManager::UsageStats {
+ struct RendererInfo : WebKit::WebCache::UsageStats {
// The access time for this renderer.
base::Time access;
};
@@ -86,10 +87,10 @@ class CacheManagerHost {
typedef std::list<Allocation> AllocationStrategy;
// This class is a singleton. Do not instantiate directly.
- CacheManagerHost();
- friend struct DefaultSingletonTraits<CacheManagerHost>;
+ WebCacheManager();
+ friend struct DefaultSingletonTraits<WebCacheManager>;
- ~CacheManagerHost();
+ ~WebCacheManager();
// Recomputes the allocation of cache resources among the renderers. Also
// informs the renderers of their new allocation.
@@ -132,13 +133,13 @@ class CacheManagerHost {
// Add up all the stats from the given set of renderers and place the result
// in |stats|.
void GatherStats(const std::set<int>& renderers,
- CacheManager::UsageStats* stats);
+ WebKit::WebCache::UsageStats* stats);
// Get the amount of memory that would be required to implement |tactic|
// using the specified allocation tactic. This function defines the
// semantics for each of the tactics.
static size_t GetSize(AllocationTactic tactic,
- const CacheManager::UsageStats& stats);
+ const WebKit::WebCache::UsageStats& stats);
// Attempt to use the specified tactics to compute an allocation strategy
// and place the result in |strategy|. |active_stats| and |inactive_stats|
@@ -148,9 +149,9 @@ class CacheManagerHost {
// Returns |true| on success and |false| on failure. Does not modify
// |strategy| on failure.
bool AttemptTactic(AllocationTactic active_tactic,
- const CacheManager::UsageStats& active_stats,
+ const WebKit::WebCache::UsageStats& active_stats,
AllocationTactic inactive_tactic,
- const CacheManager::UsageStats& inactive_stats,
+ const WebKit::WebCache::UsageStats& inactive_stats,
AllocationStrategy* strategy);
// For each renderer in |renderers|, computes its allocation according to
@@ -183,9 +184,9 @@ class CacheManagerHost {
// recently than they have been active.
std::set<int> inactive_renderers_;
- ScopedRunnableMethodFactory<CacheManagerHost> revise_allocation_factory_;
+ ScopedRunnableMethodFactory<WebCacheManager> revise_allocation_factory_;
- DISALLOW_EVIL_CONSTRUCTORS(CacheManagerHost);
+ DISALLOW_COPY_AND_ASSIGN(WebCacheManager);
};
-#endif // CHROME_BROWSER_CACHE_MANAGER_HOST_H__
+#endif // CHROME_BROWSER_WEB_CACHE_MANAGER_H_
diff --git a/chrome/browser/cache_manager_host_unittest.cc b/chrome/browser/renderer_host/web_cache_manager_unittest.cc
index 9164a47..9592582 100644
--- a/chrome/browser/cache_manager_host_unittest.cc
+++ b/chrome/browser/renderer_host/web_cache_manager_unittest.cc
@@ -5,82 +5,82 @@
#include <string>
#include "base/message_loop.h"
-#include "chrome/browser/cache_manager_host.h"
+#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/glue/cache_manager.h"
using base::Time;
using base::TimeDelta;
+using WebKit::WebCache;
-class CacheManagerHostTest : public testing::Test {
+class WebCacheManagerTest : public testing::Test {
protected:
- typedef CacheManagerHost::StatsMap StatsMap;
- typedef CacheManagerHost::Allocation Allocation;
- typedef CacheManagerHost::AllocationStrategy AllocationStrategy;
+ typedef WebCacheManager::StatsMap StatsMap;
+ typedef WebCacheManager::Allocation Allocation;
+ typedef WebCacheManager::AllocationStrategy AllocationStrategy;
static const int kRendererID;
static const int kRendererID2;
- static const CacheManager::UsageStats kStats;
- static const CacheManager::UsageStats kStats2;
+ static const WebCache::UsageStats kStats;
+ static const WebCache::UsageStats kStats2;
- // Thunks to access protected members of CacheManagerHost
- static std::map<int, CacheManagerHost::RendererInfo>& stats(
- CacheManagerHost* h) {
+ // Thunks to access protected members of WebCacheManager
+ static std::map<int, WebCacheManager::RendererInfo>& stats(
+ WebCacheManager* h) {
return h->stats_;
}
- static void SimulateInactivity(CacheManagerHost* h, int renderer_id) {
+ static void SimulateInactivity(WebCacheManager* h, int renderer_id) {
stats(h)[renderer_id].access = Time::Now() - TimeDelta::FromMinutes(
- CacheManagerHost::kRendererInactiveThresholdMinutes);
+ WebCacheManager::kRendererInactiveThresholdMinutes);
h->FindInactiveRenderers();
}
- static std::set<int>& active_renderers(CacheManagerHost* h) {
+ static std::set<int>& active_renderers(WebCacheManager* h) {
return h->active_renderers_;
}
- static std::set<int>& inactive_renderers(CacheManagerHost* h) {
+ static std::set<int>& inactive_renderers(WebCacheManager* h) {
return h->inactive_renderers_;
}
- static void GatherStats(CacheManagerHost* h,
+ static void GatherStats(WebCacheManager* h,
std::set<int> renderers,
- CacheManager::UsageStats* stats) {
+ WebCache::UsageStats* stats) {
h->GatherStats(renderers, stats);
}
static size_t GetSize(int tactic,
- const CacheManager::UsageStats& stats) {
- return CacheManagerHost::GetSize(
- static_cast<CacheManagerHost::AllocationTactic>(tactic), stats);
+ const WebCache::UsageStats& stats) {
+ return WebCacheManager::GetSize(
+ static_cast<WebCacheManager::AllocationTactic>(tactic), stats);
}
- static bool AttemptTactic(CacheManagerHost* h,
+ static bool AttemptTactic(WebCacheManager* h,
int active_tactic,
- const CacheManager::UsageStats& active_stats,
+ const WebCache::UsageStats& active_stats,
int inactive_tactic,
- const CacheManager::UsageStats& inactive_stats,
+ const WebCache::UsageStats& inactive_stats,
std::list< std::pair<int,size_t> >* strategy) {
return h->AttemptTactic(
- static_cast<CacheManagerHost::AllocationTactic>(active_tactic),
+ static_cast<WebCacheManager::AllocationTactic>(active_tactic),
active_stats,
- static_cast<CacheManagerHost::AllocationTactic>(inactive_tactic),
+ static_cast<WebCacheManager::AllocationTactic>(inactive_tactic),
inactive_stats,
strategy);
}
- static void AddToStrategy(CacheManagerHost* h,
+ static void AddToStrategy(WebCacheManager* h,
std::set<int> renderers,
int tactic,
size_t extra_bytes_to_allocate,
std::list< std::pair<int,size_t> >* strategy) {
h->AddToStrategy(renderers,
- static_cast<CacheManagerHost::AllocationTactic>(tactic),
+ static_cast<WebCacheManager::AllocationTactic>(tactic),
extra_bytes_to_allocate,
strategy);
}
enum {
- DIVIDE_EVENLY = CacheManagerHost::DIVIDE_EVENLY,
- KEEP_CURRENT_WITH_HEADROOM = CacheManagerHost::KEEP_CURRENT_WITH_HEADROOM,
- KEEP_CURRENT = CacheManagerHost::KEEP_CURRENT,
- KEEP_LIVE_WITH_HEADROOM = CacheManagerHost::KEEP_LIVE_WITH_HEADROOM,
- KEEP_LIVE = CacheManagerHost::KEEP_LIVE,
+ DIVIDE_EVENLY = WebCacheManager::DIVIDE_EVENLY,
+ KEEP_CURRENT_WITH_HEADROOM = WebCacheManager::KEEP_CURRENT_WITH_HEADROOM,
+ KEEP_CURRENT = WebCacheManager::KEEP_CURRENT,
+ KEEP_LIVE_WITH_HEADROOM = WebCacheManager::KEEP_LIVE_WITH_HEADROOM,
+ KEEP_LIVE = WebCacheManager::KEEP_LIVE,
};
private:
@@ -88,13 +88,13 @@ class CacheManagerHostTest : public testing::Test {
};
// static
-const int CacheManagerHostTest::kRendererID = 146;
+const int WebCacheManagerTest::kRendererID = 146;
// static
-const int CacheManagerHostTest::kRendererID2 = 245;
+const int WebCacheManagerTest::kRendererID2 = 245;
// static
-const CacheManager::UsageStats CacheManagerHostTest::kStats = {
+const WebCache::UsageStats WebCacheManagerTest::kStats = {
0,
1024 * 1024,
1024 * 1024,
@@ -103,7 +103,7 @@ const CacheManager::UsageStats CacheManagerHostTest::kStats = {
};
// static
-const CacheManager::UsageStats CacheManagerHostTest::kStats2 = {
+const WebCache::UsageStats WebCacheManagerTest::kStats2 = {
0,
2 * 1024 * 1024,
2 * 1024 * 1024,
@@ -111,13 +111,13 @@ const CacheManager::UsageStats CacheManagerHostTest::kStats2 = {
2 * 512,
};
-static bool operator==(const CacheManager::UsageStats& lhs,
- const CacheManager::UsageStats& rhs) {
- return !::memcmp(&lhs, &rhs, sizeof(CacheManager::UsageStats));
+static bool operator==(const WebCache::UsageStats& lhs,
+ const WebCache::UsageStats& rhs) {
+ return !::memcmp(&lhs, &rhs, sizeof(WebCache::UsageStats));
}
-TEST_F(CacheManagerHostTest, AddRemoveRendererTest) {
- CacheManagerHost* h = CacheManagerHost::GetInstance();
+TEST_F(WebCacheManagerTest, AddRemoveRendererTest) {
+ WebCacheManager* h = WebCacheManager::GetInstance();
EXPECT_EQ(0U, active_renderers(h).size());
EXPECT_EQ(0U, inactive_renderers(h).size());
@@ -131,8 +131,8 @@ TEST_F(CacheManagerHostTest, AddRemoveRendererTest) {
EXPECT_EQ(0U, inactive_renderers(h).size());
}
-TEST_F(CacheManagerHostTest, ActiveInactiveTest) {
- CacheManagerHost* h = CacheManagerHost::GetInstance();
+TEST_F(WebCacheManagerTest, ActiveInactiveTest) {
+ WebCacheManager* h = WebCacheManager::GetInstance();
h->Add(kRendererID);
@@ -151,8 +151,8 @@ TEST_F(CacheManagerHostTest, ActiveInactiveTest) {
h->Remove(kRendererID);
}
-TEST_F(CacheManagerHostTest, ObserveStatsTest) {
- CacheManagerHost* h = CacheManagerHost::GetInstance();
+TEST_F(WebCacheManagerTest, ObserveStatsTest) {
+ WebCacheManager* h = WebCacheManager::GetInstance();
h->Add(kRendererID);
@@ -166,8 +166,8 @@ TEST_F(CacheManagerHostTest, ObserveStatsTest) {
h->Remove(kRendererID);
}
-TEST_F(CacheManagerHostTest, SetGlobalSizeLimitTest) {
- CacheManagerHost* h = CacheManagerHost::GetInstance();
+TEST_F(WebCacheManagerTest, SetGlobalSizeLimitTest) {
+ WebCacheManager* h = WebCacheManager::GetInstance();
size_t limit = h->GetDefaultGlobalSizeLimit();
h->SetGlobalSizeLimit(limit);
@@ -177,8 +177,8 @@ TEST_F(CacheManagerHostTest, SetGlobalSizeLimitTest) {
EXPECT_EQ(0U, h->global_size_limit());
}
-TEST_F(CacheManagerHostTest, GatherStatsTest) {
- CacheManagerHost* h = CacheManagerHost::GetInstance();
+TEST_F(WebCacheManagerTest, GatherStatsTest) {
+ WebCacheManager* h = WebCacheManager::GetInstance();
h->Add(kRendererID);
h->Add(kRendererID2);
@@ -189,7 +189,7 @@ TEST_F(CacheManagerHostTest, GatherStatsTest) {
std::set<int> renderer_set;
renderer_set.insert(kRendererID);
- CacheManager::UsageStats stats;
+ WebCache::UsageStats stats;
GatherStats(h, renderer_set, &stats);
EXPECT_TRUE(kStats == stats);
@@ -197,12 +197,12 @@ TEST_F(CacheManagerHostTest, GatherStatsTest) {
renderer_set.insert(kRendererID2);
GatherStats(h, renderer_set, &stats);
- CacheManager::UsageStats expected_stats = kStats;
- expected_stats.min_dead_capacity += kStats2.min_dead_capacity;
- expected_stats.max_dead_capacity += kStats2.max_dead_capacity;
+ WebCache::UsageStats expected_stats = kStats;
+ expected_stats.minDeadCapacity += kStats2.minDeadCapacity;
+ expected_stats.maxDeadCapacity += kStats2.maxDeadCapacity;
expected_stats.capacity += kStats2.capacity;
- expected_stats.live_size += kStats2.live_size;
- expected_stats.dead_size += kStats2.dead_size;
+ expected_stats.liveSize += kStats2.liveSize;
+ expected_stats.deadSize += kStats2.deadSize;
EXPECT_TRUE(expected_stats == stats);
@@ -210,7 +210,7 @@ TEST_F(CacheManagerHostTest, GatherStatsTest) {
h->Remove(kRendererID2);
}
-TEST_F(CacheManagerHostTest, GetSizeTest) {
+TEST_F(WebCacheManagerTest, GetSizeTest) {
EXPECT_EQ(0U, GetSize(DIVIDE_EVENLY, kStats));
EXPECT_LT(256 * 1024u + 512, GetSize(KEEP_CURRENT_WITH_HEADROOM, kStats));
EXPECT_EQ(256 * 1024u + 512, GetSize(KEEP_CURRENT, kStats));
@@ -218,8 +218,8 @@ TEST_F(CacheManagerHostTest, GetSizeTest) {
EXPECT_EQ(256 * 1024u, GetSize(KEEP_LIVE, kStats));
}
-TEST_F(CacheManagerHostTest, AttemptTacticTest) {
- CacheManagerHost* h = CacheManagerHost::GetInstance();
+TEST_F(WebCacheManagerTest, AttemptTacticTest) {
+ WebCacheManager* h = WebCacheManager::GetInstance();
h->Add(kRendererID);
h->Add(kRendererID2);
@@ -230,8 +230,8 @@ TEST_F(CacheManagerHostTest, AttemptTacticTest) {
h->ObserveStats(kRendererID, kStats);
h->ObserveStats(kRendererID2, kStats2);
- h->SetGlobalSizeLimit(kStats.live_size + kStats.dead_size +
- kStats2.live_size + kStats2.dead_size/2);
+ h->SetGlobalSizeLimit(kStats.liveSize + kStats.deadSize +
+ kStats2.liveSize + kStats2.deadSize/2);
AllocationStrategy strategy;
@@ -254,9 +254,9 @@ TEST_F(CacheManagerHostTest, AttemptTacticTest) {
AllocationStrategy::iterator iter = strategy.begin();
while (iter != strategy.end()) {
if (iter->first == kRendererID)
- EXPECT_LE(kStats.live_size + kStats.dead_size, iter->second);
+ EXPECT_LE(kStats.liveSize + kStats.deadSize, iter->second);
else if (iter->first == kRendererID2)
- EXPECT_LE(kStats2.live_size, iter->second);
+ EXPECT_LE(kStats2.liveSize, iter->second);
else
EXPECT_FALSE("Unexpected entry in strategy");
++iter;
@@ -266,8 +266,8 @@ TEST_F(CacheManagerHostTest, AttemptTacticTest) {
h->Remove(kRendererID2);
}
-TEST_F(CacheManagerHostTest, AddToStrategyTest) {
- CacheManagerHost* h = CacheManagerHost::GetInstance();
+TEST_F(WebCacheManagerTest, AddToStrategyTest) {
+ WebCacheManager* h = WebCacheManager::GetInstance();
h->Add(kRendererID);
h->Add(kRendererID2);
@@ -296,17 +296,17 @@ TEST_F(CacheManagerHostTest, AddToStrategyTest) {
total_bytes += iter->second;
if (iter->first == kRendererID)
- EXPECT_LE(kStats.live_size + kStats.dead_size, iter->second);
+ EXPECT_LE(kStats.liveSize + kStats.deadSize, iter->second);
else if (iter->first == kRendererID2)
- EXPECT_LE(kStats2.live_size + kStats2.dead_size, iter->second);
+ EXPECT_LE(kStats2.liveSize + kStats2.deadSize, iter->second);
else
EXPECT_FALSE("Unexpected entry in strategy");
++iter;
}
size_t expected_total_bytes = kExtraBytesToAllocate +
- kStats.live_size + kStats.dead_size +
- kStats2.live_size + kStats2.dead_size;
+ kStats.liveSize + kStats.deadSize +
+ kStats2.liveSize + kStats2.deadSize;
EXPECT_GE(expected_total_bytes, total_bytes);
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index f377c96..a6fc32c 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
+#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/provisional_load_details.h"
@@ -49,7 +50,6 @@
#if defined(OS_WIN)
// TODO(port): fill these in as we flesh out the implementation of this class
-#include "chrome/browser/cache_manager_host.h"
#include "chrome/browser/download/download_request_manager.h"
#include "chrome/browser/modal_html_dialog_delegate.h"
#include "chrome/browser/plugin_service.h"
@@ -471,7 +471,7 @@ void WebContents::DidBecomeSelected() {
// If pid() is -1, that means the RenderProcessHost still hasn't been
// initialized. It'll register with CacheManagerHost when it is.
if (process()->pid() != -1)
- CacheManagerHost::GetInstance()->ObserveActivity(process()->pid());
+ WebCacheManager::GetInstance()->ObserveActivity(process()->pid());
}
void WebContents::WasHidden() {
diff --git a/chrome/browser/task_manager.h b/chrome/browser/task_manager.h
index ab27fef..8f67eb8 100644
--- a/chrome/browser/task_manager.h
+++ b/chrome/browser/task_manager.h
@@ -13,7 +13,7 @@
#include "base/singleton.h"
#include "base/ref_counted.h"
#include "base/timer.h"
-#include "chrome/browser/cache_manager_host.h"
+#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/views/controls/table/group_table_view.h"
#include "chrome/views/window/dialog_delegate.h"
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index b8eacff..dda58d8 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -470,8 +470,6 @@
'browser/browsing_data_remover.h',
'browser/browsing_instance.cc',
'browser/browsing_instance.h',
- 'browser/cache_manager_host.cc',
- 'browser/cache_manager_host.h',
'browser/cancelable_request.cc',
'browser/cancelable_request.h',
'browser/cert_store.cc',
@@ -894,6 +892,8 @@
'browser/renderer_host/save_file_resource_handler.h',
'browser/renderer_host/sync_resource_handler.cc',
'browser/renderer_host/sync_resource_handler.h',
+ 'browser/renderer_host/web_cache_manager.cc',
+ 'browser/renderer_host/web_cache_manager.h',
'browser/rlz/rlz.cc',
'browser/rlz/rlz.h',
'browser/safe_browsing/bloom_filter.cc',
@@ -1949,7 +1949,6 @@
'browser/bookmarks/bookmark_utils_unittest.cc',
'browser/browser_commands_unittest.cc',
'browser/debugger/devtools_manager_unittest.cc',
- 'browser/cache_manager_host_unittest.cc',
'browser/chrome_thread_unittest.cc',
# It is safe to list */cocoa/* files in the "common" file list
# without an explicit exclusion since gyp is smart enough to
@@ -2005,6 +2004,7 @@
'browser/renderer_host/render_widget_host_unittest.cc',
'browser/renderer_host/renderer_security_policy_unittest.cc',
'browser/renderer_host/resource_dispatcher_host_unittest.cc',
+ 'browser/renderer_host/web_cache_manager_unittest.cc',
'browser/rlz/rlz_unittest.cc',
'browser/safe_browsing/bloom_filter_unittest.cc',
'browser/safe_browsing/chunk_range_unittest.cc',
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index 64ca212..e016074 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -19,7 +19,6 @@
#include "chrome/common/ipc_sync_message.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/transport_dib.h"
-#include "webkit/glue/cache_manager.h"
#include "webkit/glue/console_message_level.h"
#include "webkit/glue/find_in_page_request.h"
#include "webkit/glue/webcursor.h"
@@ -808,59 +807,6 @@ struct ParamTraits<ConsoleMessageLevel> {
}
};
-template <>
-struct ParamTraits<CacheManager::ResourceTypeStat> {
- typedef CacheManager::ResourceTypeStat param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.count);
- WriteParam(m, p.size);
- WriteParam(m, p.live_size);
- WriteParam(m, p.decoded_size);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- bool result =
- ReadParam(m, iter, &r->count) &&
- ReadParam(m, iter, &r->size) &&
- ReadParam(m, iter, &r->live_size) &&
- ReadParam(m, iter, &r->decoded_size);
- return result;
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"%d %d %d %d", p.count, p.size, p.live_size,
- p.decoded_size));
- }
-};
-
-template <>
-struct ParamTraits<CacheManager::ResourceTypeStats> {
- typedef CacheManager::ResourceTypeStats param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.images);
- WriteParam(m, p.css_stylesheets);
- WriteParam(m, p.scripts);
- WriteParam(m, p.xsl_stylesheets);
- WriteParam(m, p.fonts);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- bool result =
- ReadParam(m, iter, &r->images) &&
- ReadParam(m, iter, &r->css_stylesheets) &&
- ReadParam(m, iter, &r->scripts) &&
- ReadParam(m, iter, &r->xsl_stylesheets) &&
- ReadParam(m, iter, &r->fonts);
- return result;
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<WebCoreStats>");
- LogParam(p.images, l);
- LogParam(p.css_stylesheets, l);
- LogParam(p.scripts, l);
- LogParam(p.xsl_stylesheets, l);
- LogParam(p.fonts, l);
- l->append(L"</WebCoreStats>");
- }
-};
-
#if defined(OS_WIN)
template <>
struct ParamTraits<XFORM> {
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index ebac85c..0053921 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -25,8 +25,8 @@
#include "net/base/upload_data.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_status.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
#include "webkit/glue/autofill_form.h"
-#include "webkit/glue/cache_manager.h"
#include "webkit/glue/context_menu.h"
#include "webkit/glue/feed.h"
#include "webkit/glue/form_data.h"
@@ -1165,27 +1165,80 @@ struct ParamTraits<net::UploadData::Element> {
}
};
-// Traits for CacheManager::UsageStats
+// Traits for WebKit::WebCache::UsageStats
template <>
-struct ParamTraits<CacheManager::UsageStats> {
- typedef CacheManager::UsageStats param_type;
+struct ParamTraits<WebKit::WebCache::UsageStats> {
+ typedef WebKit::WebCache::UsageStats param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.min_dead_capacity);
- WriteParam(m, p.max_dead_capacity);
+ WriteParam(m, p.minDeadCapacity);
+ WriteParam(m, p.maxDeadCapacity);
WriteParam(m, p.capacity);
- WriteParam(m, p.live_size);
- WriteParam(m, p.dead_size);
+ WriteParam(m, p.liveSize);
+ WriteParam(m, p.deadSize);
}
static bool Read(const Message* m, void** iter, param_type* r) {
return
- ReadParam(m, iter, &r->min_dead_capacity) &&
- ReadParam(m, iter, &r->max_dead_capacity) &&
+ ReadParam(m, iter, &r->minDeadCapacity) &&
+ ReadParam(m, iter, &r->maxDeadCapacity) &&
ReadParam(m, iter, &r->capacity) &&
- ReadParam(m, iter, &r->live_size) &&
- ReadParam(m, iter, &r->dead_size);
+ ReadParam(m, iter, &r->liveSize) &&
+ ReadParam(m, iter, &r->deadSize);
}
static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<CacheManager::UsageStats>");
+ l->append(L"<WebCache::UsageStats>");
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebCache::ResourceTypeStat> {
+ typedef WebKit::WebCache::ResourceTypeStat param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.count);
+ WriteParam(m, p.size);
+ WriteParam(m, p.liveSize);
+ WriteParam(m, p.decodedSize);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ bool result =
+ ReadParam(m, iter, &r->count) &&
+ ReadParam(m, iter, &r->size) &&
+ ReadParam(m, iter, &r->liveSize) &&
+ ReadParam(m, iter, &r->decodedSize);
+ return result;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(StringPrintf(L"%d %d %d %d", p.count, p.size, p.liveSize,
+ p.decodedSize));
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebCache::ResourceTypeStats> {
+ typedef WebKit::WebCache::ResourceTypeStats param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.images);
+ WriteParam(m, p.cssStyleSheets);
+ WriteParam(m, p.scripts);
+ WriteParam(m, p.xslStyleSheets);
+ WriteParam(m, p.fonts);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ bool result =
+ ReadParam(m, iter, &r->images) &&
+ ReadParam(m, iter, &r->cssStyleSheets) &&
+ ReadParam(m, iter, &r->scripts) &&
+ ReadParam(m, iter, &r->xslStyleSheets) &&
+ ReadParam(m, iter, &r->fonts);
+ return result;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<WebCoreStats>");
+ LogParam(p.images, l);
+ LogParam(p.cssStyleSheets, l);
+ LogParam(p.scripts, l);
+ LogParam(p.xslStyleSheets, l);
+ LogParam(p.fonts, l);
+ l->append(L"</WebCoreStats>");
}
};
@@ -1833,7 +1886,6 @@ struct ParamTraits<AudioOutputStream::State> {
}
};
-
} // namespace IPC
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index dedf4774..4d8c9a9 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -569,7 +569,7 @@ IPC_BEGIN_MESSAGES(ViewHost)
IPC_SYNC_MESSAGE_ROUTED0_0(ViewHostMsg_RunModal)
IPC_MESSAGE_CONTROL1(ViewHostMsg_UpdatedCacheStats,
- CacheManager::UsageStats /* stats */)
+ WebKit::WebCache::UsageStats /* stats */)
// Indicates the renderer is ready in response to a ViewMsg_New or
// a ViewMsg_CreatingNew_ACK.
@@ -1132,7 +1132,7 @@ IPC_BEGIN_MESSAGES(ViewHost)
// Provide the browser process with information about the WebCore resource
// cache.
IPC_MESSAGE_CONTROL1(ViewHostMsg_ResourceTypeStats,
- CacheManager::ResourceTypeStats)
+ WebKit::WebCache::ResourceTypeStats)
// Notify the browser that this render either has or doesn't have a
// beforeunload or unload handler.
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index 93c7064..4690499 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/automation/automation_provider.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_shutdown.h"
-#include "chrome/browser/cache_manager_host.h"
#include "chrome/browser/debugger/debugger_shell.h"
#include "chrome/browser/dom_ui/dom_ui.h"
#include "chrome/browser/download/download_request_dialog_delegate.h"
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 5037b50..c1a12e5 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -23,7 +23,6 @@
#include "base/gfx/rect.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/cache_manager_host.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/download/save_types.h"
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index fa81909..fb00145 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -29,22 +29,23 @@
#include "chrome/renderer/renderer_webkitclient_impl.h"
#include "chrome/renderer/user_script_slave.h"
#include "chrome/renderer/visitedlink_slave.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "v8/include/v8.h"
#include "webkit/extensions/v8/gears_extension.h"
#include "webkit/extensions/v8/interval_extension.h"
#include "webkit/extensions/v8/playback_extension.h"
-#include "webkit/glue/cache_manager.h"
-
-#include "WebKit.h"
-#include "WebString.h"
#if defined(OS_WIN)
#include <windows.h>
#include <objbase.h>
#endif
-static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */;
+using WebKit::WebCache;
+using WebKit::WebString;
+static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */;
//-----------------------------------------------------------------------------
// Methods below are only called on the owner's thread:
@@ -196,13 +197,14 @@ void RenderThread::OnSetCacheCapacities(size_t min_dead_capacity,
size_t max_dead_capacity,
size_t capacity) {
EnsureWebKitInitialized();
- CacheManager::SetCapacities(min_dead_capacity, max_dead_capacity, capacity);
+ WebCache::setCapacities(
+ min_dead_capacity, max_dead_capacity, capacity);
}
void RenderThread::OnGetCacheResourceStats() {
EnsureWebKitInitialized();
- CacheManager::ResourceTypeStats stats;
- CacheManager::GetResourceTypeStats(&stats);
+ WebCache::ResourceTypeStats stats;
+ WebCache::getResourceTypeStats(&stats);
Send(new ViewHostMsg_ResourceTypeStats(stats));
}
@@ -212,8 +214,8 @@ void RenderThread::OnGetRendererHistograms() {
void RenderThread::InformHostOfCacheStats() {
EnsureWebKitInitialized();
- CacheManager::UsageStats stats;
- CacheManager::GetUsageStats(&stats);
+ WebCache::UsageStats stats;
+ WebCache::getUsageStats(&stats);
Send(new ViewHostMsg_UpdatedCacheStats(stats));
}
@@ -240,7 +242,7 @@ void RenderThread::EnsureWebKitInitialized() {
// chrome-ui pages should not be accessible by normal content, and should
// also be unable to script anything but themselves (to help limit the damage
// that a corrupt chrome-ui page could cause).
- WebKit::WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme));
+ WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme));
WebKit::registerURLSchemeAsLocal(chrome_ui_scheme);
WebKit::registerURLSchemeAsNoAccess(chrome_ui_scheme);
diff --git a/chrome/renderer/render_view_unittest.cc b/chrome/renderer/render_view_unittest.cc
index e81cf4f..9fa394a 100644
--- a/chrome/renderer/render_view_unittest.cc
+++ b/chrome/renderer/render_view_unittest.cc
@@ -9,13 +9,12 @@
#include "chrome/renderer/render_view.h"
#include "chrome/renderer/renderer_webkitclient_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
#include "webkit/glue/webframe.h"
#include "webkit/glue/webscriptsource.h"
#include "webkit/glue/weburlrequest.h"
#include "webkit/glue/webview.h"
-#include "WebKit.h"
-
namespace {
const int32 kRouteId = 5;
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index 4cf4577..b6a1a11 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -6,6 +6,8 @@
#include "build/build_config.h"
+#include <vector>
+
#if defined(OS_WIN)
#include <windows.h>
#include <wininet.h>
@@ -22,16 +24,13 @@
#include "chrome/renderer/render_process.h"
#include "chrome/renderer/render_thread.h"
#include "googleurl/src/url_util.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "webkit/glue/scoped_clipboard_writer_glue.h"
#include "webkit/glue/webframe.h"
#include "webkit/glue/webkit_glue.h"
-#include "WebKit.h"
-#include "WebKitClient.h"
-#include "WebString.h"
-
-#include <vector>
-
#include "SkBitmap.h"
#if defined(OS_WIN)
@@ -241,7 +240,7 @@ ResourceLoaderBridge* ResourceLoaderBridge::Create(
ResourceType::Type resource_type,
int routing_id) {
ResourceDispatcher* dispatch = RenderThread::current()->resource_dispatcher();
- return dispatch->CreateBridge(method, url, policy_url, referrer,
+ return dispatch->CreateBridge(method, url, policy_url, referrer,
frame_origin, main_frame_origin, headers,
load_flags, origin_pid, resource_type,
0, routing_id);
diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc
index 28d6f73..26eb73d 100644
--- a/chrome/renderer/renderer_webkitclient_impl.cc
+++ b/chrome/renderer/renderer_webkitclient_impl.cc
@@ -4,9 +4,6 @@
#include "chrome/renderer/renderer_webkitclient_impl.h"
-#include "WebString.h"
-#include "WebURL.h"
-
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
@@ -14,6 +11,8 @@
#include "chrome/renderer/net/render_dns_master.h"
#include "chrome/renderer/render_thread.h"
#include "chrome/renderer/visitedlink_slave.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/webkit_glue.h"
diff --git a/chrome/renderer/renderer_webkitclient_impl.h b/chrome/renderer/renderer_webkitclient_impl.h
index 5eada2a..603cad9 100644
--- a/chrome/renderer/renderer_webkitclient_impl.h
+++ b/chrome/renderer/renderer_webkitclient_impl.h
@@ -9,7 +9,7 @@
#include "webkit/glue/webkitclient_impl.h"
#if defined(OS_WIN)
-#include "WebSandboxSupport.h"
+#include "third_party/WebKit/WebKit/chromium/public/win/WebSandboxSupport.h"
#endif
class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl {
diff --git a/chrome/test/unit/unit_tests.scons b/chrome/test/unit/unit_tests.scons
index 47d0341..f9ac5c1 100644
--- a/chrome/test/unit/unit_tests.scons
+++ b/chrome/test/unit/unit_tests.scons
@@ -120,7 +120,6 @@ input_files = ChromeFileList([
'$CHROME_DIR/browser/bookmarks/bookmark_table_model_unittest.cc',
'$CHROME_DIR/browser/bookmarks/bookmark_utils_unittest.cc',
'$CHROME_DIR/browser/browser_commands_unittest.cc',
- '$CHROME_DIR/browser/cache_manager_host_unittest.cc',
'$CHROME_DIR/browser/chrome_thread_unittest.cc',
'$CHROME_DIR/browser/safe_browsing/chunk_range_unittest.cc',
'$CHROME_DIR/browser/command_updater_unittest.cc',
@@ -163,6 +162,7 @@ input_files = ChromeFileList([
'$CHROME_DIR/browser/renderer_host/renderer_security_policy_unittest.cc',
'$CHROME_DIR/browser/renderer_host/resource_dispatcher_host_unittest.cc',
'$CHROME_DIR/browser/renderer_host/test_render_view_host.cc',
+ '$CHROME_DIR/browser/renderer_host/web_cache_manager_unittest.cc',
'$CHROME_DIR/browser/rlz/rlz_unittest.cc',
'$CHROME_DIR/browser/safe_browsing/safe_browsing_database_unittest.cc',
'$CHROME_DIR/browser/safe_browsing/safe_browsing_util_unittest.cc',
diff --git a/chrome/test/unit/unittests.vcproj b/chrome/test/unit/unittests.vcproj
index e48792d..b8ce6f4 100644
--- a/chrome/test/unit/unittests.vcproj
+++ b/chrome/test/unit/unittests.vcproj
@@ -428,10 +428,6 @@
>
</File>
<File
- RelativePath="..\..\browser\cache_manager_host_unittest.cc"
- >
- </File>
- <File
RelativePath="..\..\browser\chrome_thread_unittest.cc"
>
</File>
@@ -740,6 +736,10 @@
>
</File>
<File
+ RelativePath="..\..\browser\renderer_host\web_cache_manager_unittest.cc"
+ >
+ </File>
+ <File
RelativePath="..\..\browser\tab_contents\web_contents_unittest.cc"
>
</File>
diff --git a/chrome/worker/worker_thread.cc b/chrome/worker/worker_thread.cc
index b986fcd..c48eae0 100644
--- a/chrome/worker/worker_thread.cc
+++ b/chrome/worker/worker_thread.cc
@@ -8,8 +8,7 @@
#include "chrome/worker/webworkerclient_proxy.h"
#include "chrome/worker/worker_process.h"
#include "chrome/worker/worker_webkitclient_impl.h"
-
-#include "WebKit.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
WorkerThread::WorkerThread()
: ChildThread(base::Thread::Options(MessageLoop::TYPE_DEFAULT,
diff --git a/chrome/worker/worker_webkitclient_impl.cc b/chrome/worker/worker_webkitclient_impl.cc
index 94f71cf..e99347a 100644
--- a/chrome/worker/worker_webkitclient_impl.cc
+++ b/chrome/worker/worker_webkitclient_impl.cc
@@ -4,8 +4,8 @@
#include "chrome/worker/worker_webkitclient_impl.h"
-#include "WebString.h"
-#include "WebURL.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
WebKit::WebMimeRegistry* WorkerWebKitClientImpl::mimeRegistry() {
return NULL;