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

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

Issue 803813003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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_process_impl.cc ('k') | content/renderer/render_view_browsertest.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/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 326
327 private: 327 private:
328 int32_t routing_id_highmark_; 328 int32_t routing_id_highmark_;
329 }; 329 };
330 330
331 void CreateRenderFrameSetup(mojo::InterfaceRequest<RenderFrameSetup> request) { 331 void CreateRenderFrameSetup(mojo::InterfaceRequest<RenderFrameSetup> request) {
332 mojo::BindToRequest(new RenderFrameSetupImpl(), &request); 332 mojo::BindToRequest(new RenderFrameSetupImpl(), &request);
333 } 333 }
334 334
335 bool ShouldUseMojoChannel() { 335 bool ShouldUseMojoChannel() {
336 return CommandLine::ForCurrentProcess()->HasSwitch( 336 return base::CommandLine::ForCurrentProcess()->HasSwitch(
337 switches::kEnableRendererMojoChannel) || 337 switches::kEnableRendererMojoChannel) ||
338 IPC::ChannelMojo::ShouldBeUsed(); 338 IPC::ChannelMojo::ShouldBeUsed();
339 } 339 }
340 340
341 blink::WebGraphicsContext3D::Attributes GetOffscreenAttribs() { 341 blink::WebGraphicsContext3D::Attributes GetOffscreenAttribs() {
342 blink::WebGraphicsContext3D::Attributes attributes; 342 blink::WebGraphicsContext3D::Attributes attributes;
343 attributes.shareResources = true; 343 attributes.shareResources = true;
344 attributes.depth = false; 344 attributes.depth = false;
345 attributes.stencil = false; 345 attributes.stencil = false;
346 attributes.antialias = false; 346 attributes.antialias = false;
(...skipping 22 matching lines...) Expand all
369 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() { 369 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() {
370 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal"); 370 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal");
371 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted"); 371 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted");
372 custom_histograms_.insert("V8.MemoryHeapSampleTotalUsed"); 372 custom_histograms_.insert("V8.MemoryHeapSampleTotalUsed");
373 } 373 }
374 374
375 RenderThreadImpl::HistogramCustomizer::~HistogramCustomizer() {} 375 RenderThreadImpl::HistogramCustomizer::~HistogramCustomizer() {}
376 376
377 void RenderThreadImpl::HistogramCustomizer::RenderViewNavigatedToHost( 377 void RenderThreadImpl::HistogramCustomizer::RenderViewNavigatedToHost(
378 const std::string& host, size_t view_count) { 378 const std::string& host, size_t view_count) {
379 if (CommandLine::ForCurrentProcess()->HasSwitch( 379 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
380 switches::kDisableHistogramCustomizer)) { 380 switches::kDisableHistogramCustomizer)) {
381 return; 381 return;
382 } 382 }
383 // Check if all RenderViews are displaying a page from the same host. If there 383 // Check if all RenderViews are displaying a page from the same host. If there
384 // is only one RenderView, the common host is this view's host. If there are 384 // is only one RenderView, the common host is this view's host. If there are
385 // many, check if this one shares the common host of the other 385 // many, check if this one shares the common host of the other
386 // RenderViews. It's ok to not detect some cases where the RenderViews share a 386 // RenderViews. It's ok to not detect some cases where the RenderViews share a
387 // common host. This information is only used for producing custom histograms. 387 // common host. This information is only used for producing custom histograms.
388 if (view_count == 1) 388 if (view_count == 1)
389 SetCommonHost(host); 389 SetCommonHost(host);
390 else if (host != common_host_) 390 else if (host != common_host_)
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 AddFilter(midi_message_filter_.get()); 509 AddFilter(midi_message_filter_.get());
510 510
511 AddFilter((new IndexedDBMessageFilter(thread_safe_sender()))->GetFilter()); 511 AddFilter((new IndexedDBMessageFilter(thread_safe_sender()))->GetFilter());
512 512
513 AddFilter((new EmbeddedWorkerContextMessageFilter())->GetFilter()); 513 AddFilter((new EmbeddedWorkerContextMessageFilter())->GetFilter());
514 514
515 GetContentClient()->renderer()->RenderThreadStarted(); 515 GetContentClient()->renderer()->RenderThreadStarted();
516 516
517 InitSkiaEventTracer(); 517 InitSkiaEventTracer();
518 518
519 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 519 const base::CommandLine& command_line =
520 *base::CommandLine::ForCurrentProcess();
520 521
521 is_impl_side_painting_enabled_ = 522 is_impl_side_painting_enabled_ =
522 command_line.HasSwitch(switches::kEnableImplSidePainting); 523 command_line.HasSwitch(switches::kEnableImplSidePainting);
523 cc_blink::WebLayerImpl::SetImplSidePaintingEnabled( 524 cc_blink::WebLayerImpl::SetImplSidePaintingEnabled(
524 is_impl_side_painting_enabled_); 525 is_impl_side_painting_enabled_);
525 526
526 is_zero_copy_enabled_ = command_line.HasSwitch(switches::kEnableZeroCopy); 527 is_zero_copy_enabled_ = command_line.HasSwitch(switches::kEnableZeroCopy);
527 528
528 #if defined(OS_MACOSX) || defined(OS_ANDROID) 529 #if defined(OS_MACOSX) || defined(OS_ANDROID)
529 // TODO(danakj): If changing these also update NumberOfRendererRasterThreads 530 // TODO(danakj): If changing these also update NumberOfRendererRasterThreads
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 return message_loop(); 813 return message_loop();
813 } 814 }
814 815
815 IPC::SyncChannel* RenderThreadImpl::GetChannel() { 816 IPC::SyncChannel* RenderThreadImpl::GetChannel() {
816 return channel(); 817 return channel();
817 } 818 }
818 819
819 std::string RenderThreadImpl::GetLocale() { 820 std::string RenderThreadImpl::GetLocale() {
820 // The browser process should have passed the locale to the renderer via the 821 // The browser process should have passed the locale to the renderer via the
821 // --lang command line flag. 822 // --lang command line flag.
822 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 823 const base::CommandLine& parsed_command_line =
824 *base::CommandLine::ForCurrentProcess();
823 const std::string& lang = 825 const std::string& lang =
824 parsed_command_line.GetSwitchValueASCII(switches::kLang); 826 parsed_command_line.GetSwitchValueASCII(switches::kLang);
825 DCHECK(!lang.empty()); 827 DCHECK(!lang.empty());
826 return lang; 828 return lang;
827 } 829 }
828 830
829 IPC::SyncMessageFilter* RenderThreadImpl::GetSyncMessageFilter() { 831 IPC::SyncMessageFilter* RenderThreadImpl::GetSyncMessageFilter() {
830 return sync_message_filter(); 832 return sync_message_filter();
831 } 833 }
832 834
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 // The ChildResourceMessageFilter and the ResourceDispatcher need to use the 921 // The ChildResourceMessageFilter and the ResourceDispatcher need to use the
920 // same queue to ensure tasks are executed in the expected order. 922 // same queue to ensure tasks are executed in the expected order.
921 child_resource_message_filter()->SetMainThreadTaskRunner(resource_task_queue); 923 child_resource_message_filter()->SetMainThreadTaskRunner(resource_task_queue);
922 resource_dispatcher()->SetMainThreadTaskRunner(resource_task_queue); 924 resource_dispatcher()->SetMainThreadTaskRunner(resource_task_queue);
923 } 925 }
924 926
925 void RenderThreadImpl::EnsureWebKitInitialized() { 927 void RenderThreadImpl::EnsureWebKitInitialized() {
926 if (blink_platform_impl_) 928 if (blink_platform_impl_)
927 return; 929 return;
928 930
929 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 931 const base::CommandLine& command_line =
932 *base::CommandLine::ForCurrentProcess();
930 933
931 #ifdef ENABLE_VTUNE_JIT_INTERFACE 934 #ifdef ENABLE_VTUNE_JIT_INTERFACE
932 if (command_line.HasSwitch(switches::kEnableVtune)) 935 if (command_line.HasSwitch(switches::kEnableVtune))
933 gin::Debug::SetJitCodeEventHandler(vTune::GetVtuneCodeEventHandler()); 936 gin::Debug::SetJitCodeEventHandler(vTune::GetVtuneCodeEventHandler());
934 #endif 937 #endif
935 938
936 blink_platform_impl_.reset( 939 blink_platform_impl_.reset(
937 new RendererBlinkPlatformImpl(renderer_scheduler_.get())); 940 new RendererBlinkPlatformImpl(renderer_scheduler_.get()));
938 blink::initialize(blink_platform_impl_.get()); 941 blink::initialize(blink_platform_impl_.get());
939 942
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 1182
1180 void RenderThreadImpl::PostponeIdleNotification() { 1183 void RenderThreadImpl::PostponeIdleNotification() {
1181 idle_notifications_to_skip_ = 2; 1184 idle_notifications_to_skip_ = 2;
1182 } 1185 }
1183 1186
1184 scoped_refptr<media::GpuVideoAcceleratorFactories> 1187 scoped_refptr<media::GpuVideoAcceleratorFactories>
1185 RenderThreadImpl::GetGpuFactories() { 1188 RenderThreadImpl::GetGpuFactories() {
1186 DCHECK(IsMainThread()); 1189 DCHECK(IsMainThread());
1187 1190
1188 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel(); 1191 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel();
1189 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 1192 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
1190 scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories; 1193 scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories;
1191 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner = 1194 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner =
1192 GetMediaThreadTaskRunner(); 1195 GetMediaThreadTaskRunner();
1193 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { 1196 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
1194 if (!gpu_va_context_provider_.get() || 1197 if (!gpu_va_context_provider_.get() ||
1195 gpu_va_context_provider_->DestroyedOnMainThread()) { 1198 gpu_va_context_provider_->DestroyedOnMainThread()) {
1196 if (!gpu_channel_host.get()) { 1199 if (!gpu_channel_host.get()) {
1197 gpu_channel_host = EstablishGpuChannelSync( 1200 gpu_channel_host = EstablishGpuChannelSync(
1198 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E); 1201 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E);
1199 } 1202 }
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 gpu_info, 1536 gpu_info,
1534 channel_handle, 1537 channel_handle,
1535 ChildProcess::current()->GetShutDownEvent(), 1538 ChildProcess::current()->GetShutDownEvent(),
1536 gpu_memory_buffer_manager()); 1539 gpu_memory_buffer_manager());
1537 return gpu_channel_.get(); 1540 return gpu_channel_.get();
1538 } 1541 }
1539 1542
1540 blink::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter( 1543 blink::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter(
1541 blink::WebMediaStreamCenterClient* client) { 1544 blink::WebMediaStreamCenterClient* client) {
1542 #if defined(OS_ANDROID) 1545 #if defined(OS_ANDROID)
1543 if (CommandLine::ForCurrentProcess()->HasSwitch( 1546 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1544 switches::kDisableWebRTC)) 1547 switches::kDisableWebRTC))
1545 return NULL; 1548 return NULL;
1546 #endif 1549 #endif
1547 1550
1548 #if defined(ENABLE_WEBRTC) 1551 #if defined(ENABLE_WEBRTC)
1549 if (!media_stream_center_) { 1552 if (!media_stream_center_) {
1550 media_stream_center_ = GetContentClient()->renderer() 1553 media_stream_center_ = GetContentClient()->renderer()
1551 ->OverrideCreateWebMediaStreamCenter(client); 1554 ->OverrideCreateWebMediaStreamCenter(client);
1552 if (!media_stream_center_) { 1555 if (!media_stream_center_) {
1553 scoped_ptr<MediaStreamCenter> media_stream_center( 1556 scoped_ptr<MediaStreamCenter> media_stream_center(
1554 new MediaStreamCenter(client, GetPeerConnectionDependencyFactory())); 1557 new MediaStreamCenter(client, GetPeerConnectionDependencyFactory()));
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 hidden_widget_count_--; 1742 hidden_widget_count_--;
1740 1743
1741 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { 1744 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
1742 return; 1745 return;
1743 } 1746 }
1744 1747
1745 ScheduleIdleHandler(kLongIdleHandlerDelayMs); 1748 ScheduleIdleHandler(kLongIdleHandlerDelayMs);
1746 } 1749 }
1747 1750
1748 } // namespace content 1751 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_process_impl.cc ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698