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

Side by Side Diff: ios/web/app/web_main_loop.mm

Issue 2625213003: Rename *FileIO TaskScheduler worker pools to *Blocking. (Closed)
Patch Set: update dates Created 3 years, 10 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
OLDNEW
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 22 matching lines...) Expand all
33 #if !defined(__has_feature) || !__has_feature(objc_arc) 33 #if !defined(__has_feature) || !__has_feature(objc_arc)
34 #error "This file requires ARC support." 34 #error "This file requires ARC support."
35 #endif 35 #endif
36 36
37 namespace web { 37 namespace web {
38 38
39 namespace { 39 namespace {
40 40
41 enum WorkerPoolType : size_t { 41 enum WorkerPoolType : size_t {
42 BACKGROUND = 0, 42 BACKGROUND = 0,
43 BACKGROUND_FILE_IO, 43 BACKGROUND_BLOCKING,
44 FOREGROUND, 44 FOREGROUND,
45 FOREGROUND_FILE_IO, 45 FOREGROUND_BLOCKING,
46 WORKER_POOL_COUNT // Always last. 46 WORKER_POOL_COUNT // Always last.
47 }; 47 };
48 48
49 std::vector<base::SchedulerWorkerPoolParams> 49 std::vector<base::SchedulerWorkerPoolParams>
50 GetDefaultSchedulerWorkerPoolParams() { 50 GetDefaultSchedulerWorkerPoolParams() {
51 using StandbyThreadPolicy = 51 using StandbyThreadPolicy =
52 base::SchedulerWorkerPoolParams::StandbyThreadPolicy; 52 base::SchedulerWorkerPoolParams::StandbyThreadPolicy;
53 using ThreadPriority = base::ThreadPriority; 53 using ThreadPriority = base::ThreadPriority;
54 std::vector<base::SchedulerWorkerPoolParams> params_vector; 54 std::vector<base::SchedulerWorkerPoolParams> params_vector;
55 params_vector.emplace_back( 55 params_vector.emplace_back(
56 "Background", ThreadPriority::BACKGROUND, StandbyThreadPolicy::ONE, 56 "Background", ThreadPriority::BACKGROUND, StandbyThreadPolicy::ONE,
57 base::RecommendedMaxNumberOfThreadsInPool(2, 8, 0.1, 0), 57 base::RecommendedMaxNumberOfThreadsInPool(2, 8, 0.1, 0),
58 base::TimeDelta::FromSeconds(30)); 58 base::TimeDelta::FromSeconds(30));
59 params_vector.emplace_back( 59 params_vector.emplace_back(
60 "BackgroundFileIO", ThreadPriority::BACKGROUND, StandbyThreadPolicy::ONE, 60 "BackgroundBlocking", ThreadPriority::BACKGROUND,
61 StandbyThreadPolicy::ONE,
61 base::RecommendedMaxNumberOfThreadsInPool(2, 8, 0.1, 0), 62 base::RecommendedMaxNumberOfThreadsInPool(2, 8, 0.1, 0),
62 base::TimeDelta::FromSeconds(30)); 63 base::TimeDelta::FromSeconds(30));
63 params_vector.emplace_back( 64 params_vector.emplace_back(
64 "Foreground", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, 65 "Foreground", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE,
65 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.3, 0), 66 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.3, 0),
66 base::TimeDelta::FromSeconds(30)); 67 base::TimeDelta::FromSeconds(30));
67 params_vector.emplace_back( 68 params_vector.emplace_back(
68 "ForegroundFileIO", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, 69 "ForegroundBlocking", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE,
69 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), 70 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.3, 0),
fdoray 2017/02/16 16:27:40 0.1 -> 0.3 to match the existing server default co
70 base::TimeDelta::FromSeconds(30)); 71 base::TimeDelta::FromSeconds(30));
71 DCHECK_EQ(WORKER_POOL_COUNT, params_vector.size()); 72 DCHECK_EQ(WORKER_POOL_COUNT, params_vector.size());
72 return params_vector; 73 return params_vector;
73 } 74 }
74 75
75 // Returns the worker pool index for |traits| defaulting to FOREGROUND or 76 // 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 77 // FOREGROUND_BLOCKING on any other priorities based off of worker pools defined
77 // in GetDefaultSchedulerWorkerPoolParams(). 78 // in GetDefaultSchedulerWorkerPoolParams().
78 size_t DefaultBrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits) { 79 size_t DefaultBrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits) {
79 const bool is_background = 80 const bool is_background =
80 traits.priority() == base::TaskPriority::BACKGROUND; 81 traits.priority() == base::TaskPriority::BACKGROUND;
81 if (traits.may_block() || traits.with_base_sync_primitives()) 82 if (traits.may_block() || traits.with_base_sync_primitives())
82 return is_background ? BACKGROUND_FILE_IO : FOREGROUND_FILE_IO; 83 return is_background ? BACKGROUND_BLOCKING : FOREGROUND_BLOCKING;
83 84
84 return is_background ? BACKGROUND : FOREGROUND; 85 return is_background ? BACKGROUND : FOREGROUND;
85 } 86 }
86 87
87 } // namespace 88 } // namespace
88 89
89 // The currently-running WebMainLoop. There can be one or zero. 90 // The currently-running WebMainLoop. There can be one or zero.
90 // TODO(rohitrao): Desktop uses this to implement 91 // TODO(rohitrao): Desktop uses this to implement
91 // ImmediateShutdownAndExitProcess. If we don't need that functionality, we can 92 // ImmediateShutdownAndExitProcess. If we don't need that functionality, we can
92 // remove this. 93 // remove this.
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 main_thread_.reset( 337 main_thread_.reset(
337 new WebThreadImpl(WebThread::UI, base::MessageLoop::current())); 338 new WebThreadImpl(WebThread::UI, base::MessageLoop::current()));
338 } 339 }
339 340
340 int WebMainLoop::WebThreadsStarted() { 341 int WebMainLoop::WebThreadsStarted() {
341 cookie_notification_bridge_.reset(new CookieNotificationBridge); 342 cookie_notification_bridge_.reset(new CookieNotificationBridge);
342 return result_code_; 343 return result_code_;
343 } 344 }
344 345
345 } // namespace web 346 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698