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

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: Created 6 years, 4 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 289
290 frame->BindServiceRegistry(request.PassMessagePipe()); 290 frame->BindServiceRegistry(request.PassMessagePipe());
291 } 291 }
292 }; 292 };
293 293
294 void CreateRenderFrameSetup(mojo::InterfaceRequest<RenderFrameSetup> request) { 294 void CreateRenderFrameSetup(mojo::InterfaceRequest<RenderFrameSetup> request) {
295 mojo::BindToRequest(new RenderFrameSetupImpl(), &request); 295 mojo::BindToRequest(new RenderFrameSetupImpl(), &request);
296 } 296 }
297 297
298 bool ShouldUseMojoChannel() {
299 return CommandLine::ForCurrentProcess()->HasSwitch(
300 switches::kEnableRendererMojoChannel);
301 }
302
298 } // namespace 303 } // namespace
299 304
300 // For measuring memory usage after each task. Behind a command line flag. 305 // For measuring memory usage after each task. Behind a command line flag.
301 class MemoryObserver : public base::MessageLoop::TaskObserver { 306 class MemoryObserver : public base::MessageLoop::TaskObserver {
302 public: 307 public:
303 MemoryObserver() {} 308 MemoryObserver() {}
304 virtual ~MemoryObserver() {} 309 virtual ~MemoryObserver() {}
305 310
306 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE { 311 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE {
307 } 312 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 blink::mainThreadIsolate()->SetCreateHistogramFunction(CreateHistogram); 361 blink::mainThreadIsolate()->SetCreateHistogramFunction(CreateHistogram);
357 } 362 }
358 } 363 }
359 364
360 RenderThreadImpl* RenderThreadImpl::current() { 365 RenderThreadImpl* RenderThreadImpl::current() {
361 return lazy_tls.Pointer()->Get(); 366 return lazy_tls.Pointer()->Get();
362 } 367 }
363 368
364 // When we run plugins in process, we actually run them on the render thread, 369 // When we run plugins in process, we actually run them on the render thread,
365 // which means that we need to make the render thread pump UI events. 370 // which means that we need to make the render thread pump UI events.
366 RenderThreadImpl::RenderThreadImpl() { 371 RenderThreadImpl::RenderThreadImpl()
372 : ChildThread(Options(ShouldUseMojoChannel())) {
367 Init(); 373 Init();
368 } 374 }
369 375
370 RenderThreadImpl::RenderThreadImpl(const std::string& channel_name) 376 RenderThreadImpl::RenderThreadImpl(const std::string& channel_name)
371 : ChildThread(channel_name) { 377 : ChildThread(Options(channel_name, ShouldUseMojoChannel())) {
372 Init(); 378 Init();
373 } 379 }
374 380
375 void RenderThreadImpl::Init() { 381 void RenderThreadImpl::Init() {
376 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); 382 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, "");
377 383
378 base::debug::TraceLog::GetInstance()->SetThreadSortIndex( 384 base::debug::TraceLog::GetInstance()->SetThreadSortIndex(
379 base::PlatformThread::CurrentId(), 385 base::PlatformThread::CurrentId(),
380 kTraceEventRendererMainThreadSortIndex); 386 kTraceEventRendererMainThreadSortIndex);
381 387
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 hidden_widget_count_--; 1619 hidden_widget_count_--;
1614 1620
1615 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { 1621 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
1616 return; 1622 return;
1617 } 1623 }
1618 1624
1619 ScheduleIdleHandler(kLongIdleHandlerDelayMs); 1625 ScheduleIdleHandler(kLongIdleHandlerDelayMs);
1620 } 1626 }
1621 1627
1622 } // namespace content 1628 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698