Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/renderer_blink_platform_impl.h" | 5 #include "content/renderer/renderer_blink_platform_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 } | 335 } |
| 336 | 336 |
| 337 blink::WebPrescientNetworking* | 337 blink::WebPrescientNetworking* |
| 338 RendererBlinkPlatformImpl::prescientNetworking() { | 338 RendererBlinkPlatformImpl::prescientNetworking() { |
| 339 return GetContentClient()->renderer()->GetPrescientNetworking(); | 339 return GetContentClient()->renderer()->GetPrescientNetworking(); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void RendererBlinkPlatformImpl::cacheMetadata(const blink::WebURL& url, | 342 void RendererBlinkPlatformImpl::cacheMetadata(const blink::WebURL& url, |
| 343 double response_time, | 343 double response_time, |
| 344 const char* data, | 344 const char* data, |
| 345 size_t size) { | 345 size_t size) { |
|
davidben
2015/02/18 18:50:45
Why not have this function do the conversion from
| |
| 346 // Let the browser know we generated cacheable metadata for this resource. The | 346 // Let the browser know we generated cacheable metadata for this resource. The |
| 347 // browser may cache it and return it on subsequent responses to speed | 347 // browser may cache it and return it on subsequent responses to speed |
| 348 // the processing of this resource. | 348 // the processing of this resource. |
| 349 std::vector<char> copy(data, data + size); | 349 std::vector<char> copy(data, data + size); |
| 350 RenderThread::Get()->Send( | 350 RenderThread::Get()->Send( |
| 351 new ViewHostMsg_DidGenerateCacheableMetadata(url, response_time, copy)); | 351 new ViewHostMsg_DidGenerateCacheableMetadata(url, response_time, copy)); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void RendererBlinkPlatformImpl::cacheMetadata(const blink::WebURL& url, | |
| 355 int64 response_time, | |
| 356 const char* data, | |
| 357 size_t size) { | |
| 358 // Let the browser know we generated cacheable metadata for this resource. The | |
| 359 // browser may cache it and return it on subsequent responses to speed | |
| 360 // the processing of this resource. | |
| 361 std::vector<char> copy(data, data + size); | |
| 362 RenderThread::Get()->Send( | |
| 363 new ViewHostMsg_DidGenerateCacheableMetadataOriginalResponseTime( | |
| 364 url, response_time, copy)); | |
| 365 } | |
| 366 | |
| 354 WebString RendererBlinkPlatformImpl::defaultLocale() { | 367 WebString RendererBlinkPlatformImpl::defaultLocale() { |
| 355 return base::ASCIIToUTF16(RenderThread::Get()->GetLocale()); | 368 return base::ASCIIToUTF16(RenderThread::Get()->GetLocale()); |
| 356 } | 369 } |
| 357 | 370 |
| 358 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) { | 371 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) { |
| 359 if (enabled) { | 372 if (enabled) { |
| 360 // We should not get more enables than disables, but we want it to be a | 373 // We should not get more enables than disables, but we want it to be a |
| 361 // non-fatal error if it does happen. | 374 // non-fatal error if it does happen. |
| 362 DCHECK_GT(sudden_termination_disables_, 0); | 375 DCHECK_GT(sudden_termination_disables_, 0); |
| 363 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, | 376 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1213 //------------------------------------------------------------------------------ | 1226 //------------------------------------------------------------------------------ |
| 1214 | 1227 |
| 1215 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1228 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
| 1216 const blink::WebBatteryStatus& status) { | 1229 const blink::WebBatteryStatus& status) { |
| 1217 if (!g_test_battery_status_listener) | 1230 if (!g_test_battery_status_listener) |
| 1218 return; | 1231 return; |
| 1219 g_test_battery_status_listener->updateBatteryStatus(status); | 1232 g_test_battery_status_listener->updateBatteryStatus(status); |
| 1220 } | 1233 } |
| 1221 | 1234 |
| 1222 } // namespace content | 1235 } // namespace content |
| OLD | NEW |