OLD | NEW |
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 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cstdint> | 9 #include <cstdint> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 // Required for any calls into GTK functions, such as the Disconnect and | 1635 // Required for any calls into GTK functions, such as the Disconnect and |
1636 // Continue windows, though these should not be used for the Me2Me case | 1636 // Continue windows, though these should not be used for the Me2Me case |
1637 // (crbug.com/104377). | 1637 // (crbug.com/104377). |
1638 gtk_init(nullptr, nullptr); | 1638 gtk_init(nullptr, nullptr); |
1639 | 1639 |
1640 // Need to prime the host OS version value for linux to prevent IO on the | 1640 // Need to prime the host OS version value for linux to prevent IO on the |
1641 // network thread. base::GetLinuxDistro() caches the result. | 1641 // network thread. base::GetLinuxDistro() caches the result. |
1642 base::GetLinuxDistro(); | 1642 base::GetLinuxDistro(); |
1643 #endif | 1643 #endif |
1644 | 1644 |
1645 // TODO(sergeyu): Consider adding separate pools for different task classes. | 1645 base::TaskScheduler::CreateAndSetSimpleTaskScheduler("Me2Me"); |
1646 const int kMaxBackgroundThreads = 5; | |
1647 base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads); | |
1648 | 1646 |
1649 // Create the main message loop and start helper threads. | 1647 // Create the main message loop and start helper threads. |
1650 base::MessageLoopForUI message_loop; | 1648 base::MessageLoopForUI message_loop; |
1651 std::unique_ptr<ChromotingHostContext> context = | 1649 std::unique_ptr<ChromotingHostContext> context = |
1652 ChromotingHostContext::Create( | 1650 ChromotingHostContext::Create( |
1653 new AutoThreadTaskRunner(message_loop.task_runner(), | 1651 new AutoThreadTaskRunner(message_loop.task_runner(), |
1654 base::MessageLoop::QuitWhenIdleClosure())); | 1652 base::MessageLoop::QuitWhenIdleClosure())); |
1655 if (!context) | 1653 if (!context) |
1656 return kInitializationFailed; | 1654 return kInitializationFailed; |
1657 | 1655 |
(...skipping 12 matching lines...) Expand all Loading... |
1670 // Run the main (also UI) message loop until the host no longer needs it. | 1668 // Run the main (also UI) message loop until the host no longer needs it. |
1671 base::RunLoop().Run(); | 1669 base::RunLoop().Run(); |
1672 | 1670 |
1673 // Block until tasks blocking shutdown have completed their execution. | 1671 // Block until tasks blocking shutdown have completed their execution. |
1674 base::TaskScheduler::GetInstance()->Shutdown(); | 1672 base::TaskScheduler::GetInstance()->Shutdown(); |
1675 | 1673 |
1676 return exit_code; | 1674 return exit_code; |
1677 } | 1675 } |
1678 | 1676 |
1679 } // namespace remoting | 1677 } // namespace remoting |
OLD | NEW |