| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/web/app/web_main_loop.h" | 5 #include "ios/web/app/web_main_loop.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 DCHECK_EQ(WORKER_POOL_COUNT, params_vector.size()); | 71 DCHECK_EQ(WORKER_POOL_COUNT, params_vector.size()); |
| 72 return params_vector; | 72 return params_vector; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Returns the worker pool index for |traits| defaulting to FOREGROUND or | 75 // Returns the worker pool index for |traits| defaulting to FOREGROUND or |
| 76 // FOREGROUND_FILE_IO on any other priorities based off of worker pools defined | 76 // FOREGROUND_FILE_IO on any other priorities based off of worker pools defined |
| 77 // in GetDefaultSchedulerWorkerPoolParams(). | 77 // in GetDefaultSchedulerWorkerPoolParams(). |
| 78 size_t DefaultBrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits) { | 78 size_t DefaultBrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits) { |
| 79 const bool is_background = | 79 const bool is_background = |
| 80 traits.priority() == base::TaskPriority::BACKGROUND; | 80 traits.priority() == base::TaskPriority::BACKGROUND; |
| 81 if (traits.with_file_io()) | 81 if (traits.may_block() || traits.with_base_sync_primitives()) |
| 82 return is_background ? BACKGROUND_FILE_IO : FOREGROUND_FILE_IO; | 82 return is_background ? BACKGROUND_FILE_IO : FOREGROUND_FILE_IO; |
| 83 | 83 |
| 84 return is_background ? BACKGROUND : FOREGROUND; | 84 return is_background ? BACKGROUND : FOREGROUND; |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace | 87 } // namespace |
| 88 | 88 |
| 89 // The currently-running WebMainLoop. There can be one or zero. | 89 // The currently-running WebMainLoop. There can be one or zero. |
| 90 // TODO(rohitrao): Desktop uses this to implement | 90 // TODO(rohitrao): Desktop uses this to implement |
| 91 // ImmediateShutdownAndExitProcess. If we don't need that functionality, we can | 91 // ImmediateShutdownAndExitProcess. If we don't need that functionality, we can |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 main_thread_.reset( | 336 main_thread_.reset( |
| 337 new WebThreadImpl(WebThread::UI, base::MessageLoop::current())); | 337 new WebThreadImpl(WebThread::UI, base::MessageLoop::current())); |
| 338 } | 338 } |
| 339 | 339 |
| 340 int WebMainLoop::WebThreadsStarted() { | 340 int WebMainLoop::WebThreadsStarted() { |
| 341 cookie_notification_bridge_.reset(new CookieNotificationBridge); | 341 cookie_notification_bridge_.reset(new CookieNotificationBridge); |
| 342 return result_code_; | 342 return result_code_; |
| 343 } | 343 } |
| 344 | 344 |
| 345 } // namespace web | 345 } // namespace web |
| OLD | NEW |