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

Side by Side Diff: src/libplatform/default-platform.cc

Issue 1780353003: Revert of [platform] Change default platform max thread pool size 4 -> 8 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project 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 "src/libplatform/default-platform.h" 5 #include "src/libplatform/default-platform.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <queue> 8 #include <queue>
9 9
10 #include "src/base/logging.h" 10 #include "src/base/logging.h"
(...skipping 11 matching lines...) Expand all
22 platform->SetThreadPoolSize(thread_pool_size); 22 platform->SetThreadPoolSize(thread_pool_size);
23 platform->EnsureInitialized(); 23 platform->EnsureInitialized();
24 return platform; 24 return platform;
25 } 25 }
26 26
27 27
28 bool PumpMessageLoop(v8::Platform* platform, v8::Isolate* isolate) { 28 bool PumpMessageLoop(v8::Platform* platform, v8::Isolate* isolate) {
29 return reinterpret_cast<DefaultPlatform*>(platform)->PumpMessageLoop(isolate); 29 return reinterpret_cast<DefaultPlatform*>(platform)->PumpMessageLoop(isolate);
30 } 30 }
31 31
32 const int DefaultPlatform::kMaxThreadPoolSize = 8; 32
33 const int DefaultPlatform::kMaxThreadPoolSize = 4;
34
33 35
34 DefaultPlatform::DefaultPlatform() 36 DefaultPlatform::DefaultPlatform()
35 : initialized_(false), thread_pool_size_(0) {} 37 : initialized_(false), thread_pool_size_(0) {}
36 38
37 39
38 DefaultPlatform::~DefaultPlatform() { 40 DefaultPlatform::~DefaultPlatform() {
39 base::LockGuard<base::Mutex> guard(&lock_); 41 base::LockGuard<base::Mutex> guard(&lock_);
40 queue_.Terminate(); 42 queue_.Terminate();
41 if (initialized_) { 43 if (initialized_) {
42 for (auto i = thread_pool_.begin(); i != thread_pool_.end(); ++i) { 44 for (auto i = thread_pool_.begin(); i != thread_pool_.end(); ++i) {
(...skipping 14 matching lines...) Expand all
57 i->second.pop(); 59 i->second.pop();
58 } 60 }
59 } 61 }
60 } 62 }
61 63
62 64
63 void DefaultPlatform::SetThreadPoolSize(int thread_pool_size) { 65 void DefaultPlatform::SetThreadPoolSize(int thread_pool_size) {
64 base::LockGuard<base::Mutex> guard(&lock_); 66 base::LockGuard<base::Mutex> guard(&lock_);
65 DCHECK(thread_pool_size >= 0); 67 DCHECK(thread_pool_size >= 0);
66 if (thread_pool_size < 1) { 68 if (thread_pool_size < 1) {
67 thread_pool_size = base::SysInfo::NumberOfProcessors() - 1; 69 thread_pool_size = base::SysInfo::NumberOfProcessors();
68 } 70 }
69 thread_pool_size_ = 71 thread_pool_size_ =
70 std::max(std::min(thread_pool_size, kMaxThreadPoolSize), 1); 72 std::max(std::min(thread_pool_size, kMaxThreadPoolSize), 1);
71 } 73 }
72 74
73 75
74 void DefaultPlatform::EnsureInitialized() { 76 void DefaultPlatform::EnsureInitialized() {
75 base::LockGuard<base::Mutex> guard(&lock_); 77 base::LockGuard<base::Mutex> guard(&lock_);
76 if (initialized_) return; 78 if (initialized_) return;
77 initialized_ = true; 79 initialized_ = true;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return dummy; 195 return dummy;
194 } 196 }
195 197
196 198
197 size_t DefaultPlatform::NumberOfAvailableBackgroundThreads() { 199 size_t DefaultPlatform::NumberOfAvailableBackgroundThreads() {
198 return static_cast<size_t>(thread_pool_size_); 200 return static_cast<size_t>(thread_pool_size_);
199 } 201 }
200 202
201 } // namespace platform 203 } // namespace platform
202 } // namespace v8 204 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698