OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // On Mac, one can't make shortcuts with command-line arguments. Instead, we | 5 // On Mac, one can't make shortcuts with command-line arguments. Instead, we |
6 // produce small app bundles which locate the Chromium framework and load it, | 6 // produce small app bundles which locate the Chromium framework and load it, |
7 // passing the appropriate data. This is the entry point into the framework for | 7 // passing the appropriate data. This is the entry point into the framework for |
8 // those app bundles. | 8 // those app bundles. |
9 | 9 |
10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 locale, NULL, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); | 634 locale, NULL, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); |
635 | 635 |
636 // Launch the IO thread. | 636 // Launch the IO thread. |
637 base::Thread::Options io_thread_options; | 637 base::Thread::Options io_thread_options; |
638 io_thread_options.message_loop_type = base::MessageLoop::TYPE_IO; | 638 io_thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
639 base::Thread *io_thread = new base::Thread("CrAppShimIO"); | 639 base::Thread *io_thread = new base::Thread("CrAppShimIO"); |
640 io_thread->StartWithOptions(io_thread_options); | 640 io_thread->StartWithOptions(io_thread_options); |
641 g_io_thread = io_thread; | 641 g_io_thread = io_thread; |
642 | 642 |
643 mojo::edk::Init(); | 643 mojo::edk::Init(); |
644 mojo::edk::ScopedIPCSupport ipc_support(io_thread->task_runner()); | 644 mojo::edk::ScopedIPCSupport ipc_support( |
| 645 io_thread->task_runner(), |
| 646 mojo::edk::ScopedIPCSupport::ShutdownPolicy::FAST); |
645 | 647 |
646 // Find already running instances of Chrome. | 648 // Find already running instances of Chrome. |
647 pid_t pid = -1; | 649 pid_t pid = -1; |
648 std::string chrome_process_id = | 650 std::string chrome_process_id = |
649 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 651 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
650 app_mode::kLaunchedByChromeProcessId); | 652 app_mode::kLaunchedByChromeProcessId); |
651 if (!chrome_process_id.empty()) { | 653 if (!chrome_process_id.empty()) { |
652 if (!base::StringToInt(chrome_process_id, &pid)) | 654 if (!base::StringToInt(chrome_process_id, &pid)) |
653 LOG(FATAL) << "Invalid PID: " << chrome_process_id; | 655 LOG(FATAL) << "Invalid PID: " << chrome_process_id; |
654 } else { | 656 } else { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 // which is preferable to waiting for the Apple Event to timeout after one | 706 // which is preferable to waiting for the Apple Event to timeout after one |
705 // minute. | 707 // minute. |
706 main_message_loop.task_runner()->PostTask( | 708 main_message_loop.task_runner()->PostTask( |
707 FROM_HERE, | 709 FROM_HERE, |
708 base::Bind(&AppShimController::Init, base::Unretained(&controller))); | 710 base::Bind(&AppShimController::Init, base::Unretained(&controller))); |
709 } | 711 } |
710 | 712 |
711 base::RunLoop().Run(); | 713 base::RunLoop().Run(); |
712 return 0; | 714 return 0; |
713 } | 715 } |
OLD | NEW |