Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/renderer/renderer_webkitclient_impl.cc

Issue 1698001: Receive cacheable metadata from the renderer and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/renderer_webkitclient_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/renderer_webkitclient_impl.h" 5 #include "chrome/renderer/renderer_webkitclient_impl.h"
6 6
7 #if defined(USE_SYSTEM_SQLITE) 7 #if defined(USE_SYSTEM_SQLITE)
8 #include <sqlite3.h> 8 #include <sqlite3.h>
9 #else 9 #else
10 #include "third_party/sqlite/preprocessed/sqlite3.h" 10 #include "third_party/sqlite/preprocessed/sqlite3.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 void RendererWebKitClientImpl::prefetchHostName(const WebString& hostname) { 130 void RendererWebKitClientImpl::prefetchHostName(const WebString& hostname) {
131 if (!hostname.isEmpty()) { 131 if (!hostname.isEmpty()) {
132 std::string hostname_utf8; 132 std::string hostname_utf8;
133 UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); 133 UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8);
134 DnsPrefetchCString(hostname_utf8.data(), hostname_utf8.length()); 134 DnsPrefetchCString(hostname_utf8.data(), hostname_utf8.length());
135 } 135 }
136 } 136 }
137 137
138 bool RendererWebKitClientImpl::CheckPreparsedJsCachingEnabled() const {
139 static bool checked = false;
140 static bool result = false;
141 if (!checked) {
142 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
143 result = command_line.HasSwitch(switches::kEnablePreparsedJsCaching);
144 checked = true;
145 }
146 return result;
147 }
148
149 void RendererWebKitClientImpl::cacheMetadata(
150 const WebKit::WebURL& url,
151 double response_time,
152 const char* data,
153 size_t size) {
154 if (!CheckPreparsedJsCachingEnabled())
155 return;
156
157 // Let the browser know we generated cacheable metadata for this resource. The
158 // browser may cache it and return it on subsequent responses to speed
159 // the processing of this resource.
160 std::vector<char> copy(data, data + size);
161 RenderThread::current()->Send(new ViewHostMsg_DidGenerateCacheableMetadata(
162 url, response_time, copy));
163 }
164
138 WebString RendererWebKitClientImpl::defaultLocale() { 165 WebString RendererWebKitClientImpl::defaultLocale() {
139 // TODO(darin): Eliminate this webkit_glue call. 166 // TODO(darin): Eliminate this webkit_glue call.
140 return WideToUTF16(webkit_glue::GetWebKitLocale()); 167 return WideToUTF16(webkit_glue::GetWebKitLocale());
141 } 168 }
142 169
143 void RendererWebKitClientImpl::suddenTerminationChanged(bool enabled) { 170 void RendererWebKitClientImpl::suddenTerminationChanged(bool enabled) {
144 if (enabled) { 171 if (enabled) {
145 // We should not get more enables than disables, but we want it to be a 172 // We should not get more enables than disables, but we want it to be a
146 // non-fatal error if it does happen. 173 // non-fatal error if it does happen.
147 DCHECK_GT(sudden_termination_disables_, 0); 174 DCHECK_GT(sudden_termination_disables_, 0);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 const WebKit::WebString& challenge, 398 const WebKit::WebString& challenge,
372 const WebKit::WebURL& url) { 399 const WebKit::WebURL& url) {
373 std::string signed_public_key; 400 std::string signed_public_key;
374 RenderThread::current()->Send(new ViewHostMsg_Keygen( 401 RenderThread::current()->Send(new ViewHostMsg_Keygen(
375 static_cast<uint32>(key_size_index), 402 static_cast<uint32>(key_size_index),
376 challenge.utf8(), 403 challenge.utf8(),
377 GURL(url), 404 GURL(url),
378 &signed_public_key)); 405 &signed_public_key));
379 return WebString::fromUTF8(signed_public_key); 406 return WebString::fromUTF8(signed_public_key);
380 } 407 }
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_webkitclient_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698