| 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 #include "content/renderer/render_process_impl.h" | 5 #include "content/renderer/render_process_impl.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 DCHECK_EQ(WORKER_POOL_COUNT, params_vector.size()); | 113 DCHECK_EQ(WORKER_POOL_COUNT, params_vector.size()); |
| 114 return params_vector; | 114 return params_vector; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Returns the worker pool index for |traits| defaulting to FOREGROUND or | 117 // Returns the worker pool index for |traits| defaulting to FOREGROUND or |
| 118 // FOREGROUND_FILE_IO on any other priorities based off of worker pools defined | 118 // FOREGROUND_FILE_IO on any other priorities based off of worker pools defined |
| 119 // in GetDefaultSchedulerWorkerPoolParams(). | 119 // in GetDefaultSchedulerWorkerPoolParams(). |
| 120 size_t DefaultRendererWorkerPoolIndexForTraits(const base::TaskTraits& traits) { | 120 size_t DefaultRendererWorkerPoolIndexForTraits(const base::TaskTraits& traits) { |
| 121 const bool is_background = | 121 const bool is_background = |
| 122 traits.priority() == base::TaskPriority::BACKGROUND; | 122 traits.priority() == base::TaskPriority::BACKGROUND; |
| 123 if (traits.with_file_io()) | 123 if (traits.may_block() || traits.with_base_sync_primitives()) |
| 124 return is_background ? BACKGROUND_FILE_IO : FOREGROUND_FILE_IO; | 124 return is_background ? BACKGROUND_FILE_IO : FOREGROUND_FILE_IO; |
| 125 | 125 |
| 126 return is_background ? BACKGROUND : FOREGROUND; | 126 return is_background ? BACKGROUND : FOREGROUND; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void InitializeTaskScheduler() { | 129 void InitializeTaskScheduler() { |
| 130 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 130 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 131 switches::kSingleProcess)) { | 131 switches::kSingleProcess)) { |
| 132 // There should already be a TaskScheduler when the renderer runs inside the | 132 // There should already be a TaskScheduler when the renderer runs inside the |
| 133 // browser process. | 133 // browser process. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 void RenderProcessImpl::AddBindings(int bindings) { | 236 void RenderProcessImpl::AddBindings(int bindings) { |
| 237 enabled_bindings_ |= bindings; | 237 enabled_bindings_ |= bindings; |
| 238 } | 238 } |
| 239 | 239 |
| 240 int RenderProcessImpl::GetEnabledBindings() const { | 240 int RenderProcessImpl::GetEnabledBindings() const { |
| 241 return enabled_bindings_; | 241 return enabled_bindings_; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace content | 244 } // namespace content |
| OLD | NEW |