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

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

Issue 382333002: Introduce ChannelMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed ChanelBuilder to ChannelFactory Created 6 years, 5 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
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 frame->BindServiceRegistry(request.PassMessagePipe()); 284 frame->BindServiceRegistry(request.PassMessagePipe());
285 } 285 }
286 286
287 virtual void OnConnectionError() OVERRIDE { delete this; } 287 virtual void OnConnectionError() OVERRIDE { delete this; }
288 }; 288 };
289 289
290 void CreateRenderFrameSetup(mojo::InterfaceRequest<RenderFrameSetup> request) { 290 void CreateRenderFrameSetup(mojo::InterfaceRequest<RenderFrameSetup> request) {
291 mojo::BindToRequest(new RenderFrameSetupImpl(), &request); 291 mojo::BindToRequest(new RenderFrameSetupImpl(), &request);
292 } 292 }
293 293
294 bool IsMojoChannelEnabled() {
darin (slow to review) 2014/07/23 23:03:33 nit: ShouldUseMojoChannel
Hajime Morrita 2014/07/24 00:38:44 Done.
295 return CommandLine::ForCurrentProcess()->HasSwitch(
296 switches::kEnableRendererMojoChannel);
297 }
298
294 } // namespace 299 } // namespace
295 300
296 // For measuring memory usage after each task. Behind a command line flag. 301 // For measuring memory usage after each task. Behind a command line flag.
297 class MemoryObserver : public base::MessageLoop::TaskObserver { 302 class MemoryObserver : public base::MessageLoop::TaskObserver {
298 public: 303 public:
299 MemoryObserver() {} 304 MemoryObserver() {}
300 virtual ~MemoryObserver() {} 305 virtual ~MemoryObserver() {}
301 306
302 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE { 307 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE {
303 } 308 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 blink::mainThreadIsolate()->SetCreateHistogramFunction(CreateHistogram); 357 blink::mainThreadIsolate()->SetCreateHistogramFunction(CreateHistogram);
353 } 358 }
354 } 359 }
355 360
356 RenderThreadImpl* RenderThreadImpl::current() { 361 RenderThreadImpl* RenderThreadImpl::current() {
357 return lazy_tls.Pointer()->Get(); 362 return lazy_tls.Pointer()->Get();
358 } 363 }
359 364
360 // When we run plugins in process, we actually run them on the render thread, 365 // When we run plugins in process, we actually run them on the render thread,
361 // which means that we need to make the render thread pump UI events. 366 // which means that we need to make the render thread pump UI events.
362 RenderThreadImpl::RenderThreadImpl() { 367 RenderThreadImpl::RenderThreadImpl()
368 : ChildThread(InitOptions("", IsMojoChannelEnabled())) {
363 Init(); 369 Init();
364 } 370 }
365 371
366 RenderThreadImpl::RenderThreadImpl(const std::string& channel_name) 372 RenderThreadImpl::RenderThreadImpl(const std::string& channel_name)
367 : ChildThread(channel_name) { 373 : ChildThread(InitOptions(channel_name, IsMojoChannelEnabled())) {
368 Init(); 374 Init();
369 } 375 }
370 376
371 void RenderThreadImpl::Init() { 377 void RenderThreadImpl::Init() {
372 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); 378 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, "");
373 379
374 base::debug::TraceLog::GetInstance()->SetThreadSortIndex( 380 base::debug::TraceLog::GetInstance()->SetThreadSortIndex(
375 base::PlatformThread::CurrentId(), 381 base::PlatformThread::CurrentId(),
376 kTraceEventRendererMainThreadSortIndex); 382 kTraceEventRendererMainThreadSortIndex);
377 383
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 hidden_widget_count_--; 1602 hidden_widget_count_--;
1597 1603
1598 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { 1604 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
1599 return; 1605 return;
1600 } 1606 }
1601 1607
1602 ScheduleIdleHandler(kLongIdleHandlerDelayMs); 1608 ScheduleIdleHandler(kLongIdleHandlerDelayMs);
1603 } 1609 }
1604 1610
1605 } // namespace content 1611 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698