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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 1782133002: Instrument MojoShellConnectionImpl::BindToMessagePipe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | content/renderer/renderer_main.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/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/base_switches.h" 11 #include "base/base_switches.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/debug/leak_annotations.h" 13 #include "base/debug/leak_annotations.h"
14 #include "base/debug/profiler.h" 14 #include "base/debug/profiler.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/message_loop/timer_slack.h" 19 #include "base/message_loop/timer_slack.h"
20 #include "base/metrics/field_trial.h" 20 #include "base/metrics/field_trial.h"
21 #include "base/metrics/histogram_macros.h"
21 #include "base/process/process.h" 22 #include "base/process/process.h"
22 #include "base/process/process_handle.h" 23 #include "base/process/process_handle.h"
23 #include "base/single_thread_task_runner.h" 24 #include "base/single_thread_task_runner.h"
24 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
25 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
26 #include "base/synchronization/condition_variable.h" 27 #include "base/synchronization/condition_variable.h"
27 #include "base/synchronization/lock.h" 28 #include "base/synchronization/lock.h"
28 #include "base/thread_task_runner_handle.h" 29 #include "base/thread_task_runner_handle.h"
29 #include "base/threading/thread_local.h" 30 #include "base/threading/thread_local.h"
31 #include "base/timer/elapsed_timer.h"
30 #include "base/tracked_objects.h" 32 #include "base/tracked_objects.h"
31 #include "build/build_config.h" 33 #include "build/build_config.h"
32 #include "components/tracing/child_trace_message_filter.h" 34 #include "components/tracing/child_trace_message_filter.h"
33 #include "content/child/child_discardable_shared_memory_manager.h" 35 #include "content/child/child_discardable_shared_memory_manager.h"
34 #include "content/child/child_gpu_memory_buffer_manager.h" 36 #include "content/child/child_gpu_memory_buffer_manager.h"
35 #include "content/child/child_histogram_message_filter.h" 37 #include "content/child/child_histogram_message_filter.h"
36 #include "content/child/child_process.h" 38 #include "content/child/child_process.h"
37 #include "content/child/child_resource_message_filter.h" 39 #include "content/child/child_resource_message_filter.h"
38 #include "content/child/child_shared_bitmap_manager.h" 40 #include "content/child/child_shared_bitmap_manager.h"
39 #include "content/child/fileapi/file_system_dispatcher.h" 41 #include "content/child/fileapi/file_system_dispatcher.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 413 }
412 414
413 // If this process was launched with a primordial pipe token, we exchange it 415 // If this process was launched with a primordial pipe token, we exchange it
414 // for a pipe to connect to the shell. 416 // for a pipe to connect to the shell.
415 std::string pipe_token = 417 std::string pipe_token =
416 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 418 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
417 switches::kMojoPrimordialPipeToken); 419 switches::kMojoPrimordialPipeToken);
418 if (!pipe_token.empty() && MojoShellConnectionImpl::Get()) { 420 if (!pipe_token.empty() && MojoShellConnectionImpl::Get()) {
419 mojo::ScopedMessagePipeHandle pipe = 421 mojo::ScopedMessagePipeHandle pipe =
420 mojo::edk::CreateChildMessagePipe(pipe_token); 422 mojo::edk::CreateChildMessagePipe(pipe_token);
423
424 base::ElapsedTimer timer;
421 MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(pipe)); 425 MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(pipe));
426 UMA_HISTOGRAM_TIMES("Mojo.Shell.ChildConnectionTime", timer.Elapsed());
422 } 427 }
423 428
424 mojo_application_.reset(new MojoApplication(GetIOTaskRunner())); 429 mojo_application_.reset(new MojoApplication(GetIOTaskRunner()));
425 430
426 sync_message_filter_ = channel_->CreateSyncMessageFilter(); 431 sync_message_filter_ = channel_->CreateSyncMessageFilter();
427 thread_safe_sender_ = new ThreadSafeSender( 432 thread_safe_sender_ = new ThreadSafeSender(
428 message_loop_->task_runner(), sync_message_filter_.get()); 433 message_loop_->task_runner(), sync_message_filter_.get());
429 434
430 resource_dispatcher_.reset(new ResourceDispatcher( 435 resource_dispatcher_.reset(new ResourceDispatcher(
431 this, message_loop()->task_runner())); 436 this, message_loop()->task_runner()));
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 void ChildThreadImpl::EnsureConnected() { 750 void ChildThreadImpl::EnsureConnected() {
746 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 751 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
747 base::Process::Current().Terminate(0, false); 752 base::Process::Current().Terminate(0, false);
748 } 753 }
749 754
750 bool ChildThreadImpl::IsInBrowserProcess() const { 755 bool ChildThreadImpl::IsInBrowserProcess() const {
751 return browser_process_io_runner_; 756 return browser_process_io_runner_;
752 } 757 }
753 758
754 } // namespace content 759 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/renderer_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698