| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { |
| 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(new ViewHostMsg_DidGenerateCacheableMetadata( |
| 351 new ViewHostMsg_DidGenerateCacheableMetadata(url, response_time, copy)); | 351 url, base::Time::FromDoubleT(response_time), copy)); |
| 352 } |
| 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(new ViewHostMsg_DidGenerateCacheableMetadata( |
| 363 url, base::Time::FromInternalValue(response_time), copy)); |
| 352 } | 364 } |
| 353 | 365 |
| 354 WebString RendererBlinkPlatformImpl::defaultLocale() { | 366 WebString RendererBlinkPlatformImpl::defaultLocale() { |
| 355 return base::ASCIIToUTF16(RenderThread::Get()->GetLocale()); | 367 return base::ASCIIToUTF16(RenderThread::Get()->GetLocale()); |
| 356 } | 368 } |
| 357 | 369 |
| 358 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) { | 370 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) { |
| 359 if (enabled) { | 371 if (enabled) { |
| 360 // We should not get more enables than disables, but we want it to be a | 372 // We should not get more enables than disables, but we want it to be a |
| 361 // non-fatal error if it does happen. | 373 // non-fatal error if it does happen. |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 //------------------------------------------------------------------------------ | 1225 //------------------------------------------------------------------------------ |
| 1214 | 1226 |
| 1215 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1227 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
| 1216 const blink::WebBatteryStatus& status) { | 1228 const blink::WebBatteryStatus& status) { |
| 1217 if (!g_test_battery_status_listener) | 1229 if (!g_test_battery_status_listener) |
| 1218 return; | 1230 return; |
| 1219 g_test_battery_status_listener->updateBatteryStatus(status); | 1231 g_test_battery_status_listener->updateBatteryStatus(status); |
| 1220 } | 1232 } |
| 1221 | 1233 |
| 1222 } // namespace content | 1234 } // namespace content |
| OLD | NEW |