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

Side by Side Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 2469353003: Skip base::string16 if not necessary for WebString <-> ASCII conversion (Closed)
Patch Set: minor fix Created 4 years, 1 month 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
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/webclipboard_impl.cc » ('j') | 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) 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // CacheStorage. The browser may cache it and return it on subsequent 429 // CacheStorage. The browser may cache it and return it on subsequent
430 // responses to speed the processing of this resource. 430 // responses to speed the processing of this resource.
431 std::vector<char> copy(data, data + size); 431 std::vector<char> copy(data, data + size);
432 RenderThread::Get()->Send( 432 RenderThread::Get()->Send(
433 new RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage( 433 new RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage(
434 url, base::Time::FromInternalValue(response_time), copy, 434 url, base::Time::FromInternalValue(response_time), copy,
435 cacheStorageOrigin, cacheStorageCacheName.utf8())); 435 cacheStorageOrigin, cacheStorageCacheName.utf8()));
436 } 436 }
437 437
438 WebString RendererBlinkPlatformImpl::defaultLocale() { 438 WebString RendererBlinkPlatformImpl::defaultLocale() {
439 return base::ASCIIToUTF16(RenderThread::Get()->GetLocale()); 439 return WebString::fromASCII(RenderThread::Get()->GetLocale());
440 } 440 }
441 441
442 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) { 442 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) {
443 if (enabled) { 443 if (enabled) {
444 // We should not get more enables than disables, but we want it to be a 444 // We should not get more enables than disables, but we want it to be a
445 // non-fatal error if it does happen. 445 // non-fatal error if it does happen.
446 DCHECK_GT(sudden_termination_disables_, 0); 446 DCHECK_GT(sudden_termination_disables_, 0);
447 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, 447 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1,
448 0); 448 0);
449 if (sudden_termination_disables_ != 0) 449 if (sudden_termination_disables_ != 0)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // The sandbox restricts our access to the registry, so we need to proxy 506 // The sandbox restricts our access to the registry, so we need to proxy
507 // these calls over to the browser process. 507 // these calls over to the browser process.
508 if (!mime_registry_) 508 if (!mime_registry_)
509 RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&mime_registry_); 509 RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&mime_registry_);
510 510
511 mojo::String mime_type; 511 mojo::String mime_type;
512 if (!mime_registry_->GetMimeTypeFromExtension( 512 if (!mime_registry_->GetMimeTypeFromExtension(
513 mojo::String::From(base::string16(file_extension)), &mime_type)) { 513 mojo::String::From(base::string16(file_extension)), &mime_type)) {
514 return WebString(); 514 return WebString();
515 } 515 }
516 return base::ASCIIToUTF16(mime_type.get()); 516 return WebString::fromASCII(mime_type.get());
517 } 517 }
518 518
519 //------------------------------------------------------------------------------ 519 //------------------------------------------------------------------------------
520 520
521 bool RendererBlinkPlatformImpl::FileUtilities::getFileInfo( 521 bool RendererBlinkPlatformImpl::FileUtilities::getFileInfo(
522 const WebString& path, 522 const WebString& path,
523 WebFileInfo& web_file_info) { 523 WebFileInfo& web_file_info) {
524 base::File::Info file_info; 524 base::File::Info file_info;
525 base::File::Error status = base::File::FILE_ERROR_MAX; 525 base::File::Error status = base::File::FILE_ERROR_MAX;
526 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( 526 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo(
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 return &trial_token_validator_; 1326 return &trial_token_validator_;
1327 } 1327 }
1328 1328
1329 void RendererBlinkPlatformImpl::workerContextCreated( 1329 void RendererBlinkPlatformImpl::workerContextCreated(
1330 const v8::Local<v8::Context>& worker) { 1330 const v8::Local<v8::Context>& worker) {
1331 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( 1331 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
1332 worker); 1332 worker);
1333 } 1333 }
1334 1334
1335 } // namespace content 1335 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/webclipboard_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698