diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 22:31:35 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 22:31:35 +0000 |
commit | de56f378336660dcc848763c80267a5e063ae47d (patch) | |
tree | 7f551b88923b35bc4022ce6ab3a3f602fb60d91c /chrome/renderer/renderer_glue.cc | |
parent | dc4f63c80cb90efe594131030aad6776e5945fcc (diff) | |
download | chromium_src-de56f378336660dcc848763c80267a5e063ae47d.zip chromium_src-de56f378336660dcc848763c80267a5e063ae47d.tar.gz chromium_src-de56f378336660dcc848763c80267a5e063ae47d.tar.bz2 |
Merge the chrome_webkit_merge_branch back on to trunk. This brings us
up to webkit@36102.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/renderer_glue.cc')
-rw-r--r-- | chrome/renderer/renderer_glue.cc | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index 324c87c..9de5f15 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -68,53 +68,16 @@ class ResizableStackArray { namespace webkit_glue { -bool HistoryContains(const wchar_t* url, int url_length, - const char* document_host, int document_host_length, - bool is_dns_prefetch_enabled) { - if (url_length == 0) - return false; // Empty URLs are not visited. - - // Use big stack buffer to avoid allocation when possible. - url_parse::Parsed parsed; - url_canon::RawCanonOutput<2048> canon; - - if (!url_util::Canonicalize(url, url_length, NULL, &canon, &parsed)) - return false; // Invalid URLs are not visited. - - char* parsed_host = canon.data() + parsed.host.begin; - - // If the hostnames match or is_dns_prefetch_enabled is true, do the prefetch. - if (parsed.host.is_nonempty()) { - if (is_dns_prefetch_enabled || - (document_host_length > 0 && parsed.host.len == document_host_length && - strncmp(parsed_host, document_host, parsed.host.len) == 0)) - DnsPrefetchCString(parsed_host, parsed.host.len); - } - - return RenderThread::current()->visited_link_slave()-> - IsVisited(canon.data(), canon.length()); -} - -void DnsPrefetchUrl(const wchar_t* url, int url_length) { - if (url_length == 0) - return; // Empty URLs have no hostnames. - - // Use big stack buffer to avoid allocation when possible. - url_parse::Parsed parsed; - url_canon::RawCanonOutput<2048> canon; - - if (!url_util::Canonicalize(url, url_length, NULL, &canon, &parsed)) - return; // Invalid URLs don't have hostnames. - - // Call for prefetching without creating a std::string(). - if (parsed.host.is_nonempty()) - DnsPrefetchCString(canon.data() + parsed.host.begin, parsed.host.len); +void PrefetchDns(const std::string& hostname) { + if (!hostname.empty()) + DnsPrefetchCString(hostname.c_str(), hostname.length()); } void PrecacheUrl(const wchar_t* url, int url_length) { // TBD: jar: Need implementation that loads the targetted URL into our cache. // For now, at least prefetch DNS lookup - DnsPrefetchUrl(url, url_length); + GURL parsed_url(std::wstring(url, url_length)); + PrefetchDns(parsed_url.host()); } void webkit_glue::AppendToLog(const char* file, int line, const char* msg) { @@ -168,6 +131,10 @@ std::string webkit_glue::GetDataResource(int resource_id) { return ResourceBundle::GetSharedInstance().GetDataResource(resource_id); } +SkBitmap* webkit_glue::GetBitmapResource(int resource_id) { + return ResourceBundle::GetSharedInstance().GetBitmapNamed(resource_id); +} + HCURSOR webkit_glue::LoadCursor(int cursor_id) { return ResourceBundle::GetSharedInstance().LoadCursor(cursor_id); } |