OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/tracing/background_tracing_manager_impl.h" | 5 #include "content/browser/tracing/background_tracing_manager_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 11 #include "base/location.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
13 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" |
14 #include "base/time/time.h" | 17 #include "base/time/time.h" |
15 #include "content/browser/tracing/background_tracing_rule.h" | 18 #include "content/browser/tracing/background_tracing_rule.h" |
16 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/content_browser_client.h" | 20 #include "content/public/browser/content_browser_client.h" |
18 #include "content/public/browser/tracing_delegate.h" | 21 #include "content/public/browser/tracing_delegate.h" |
19 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
20 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
21 | 24 |
22 namespace content { | 25 namespace content { |
23 | 26 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // we have to wait until initialization is finished to validate that the | 135 // we have to wait until initialization is finished to validate that the |
133 // scenario can run. | 136 // scenario can run. |
134 if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) { | 137 if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) { |
135 // TODO(oysteine): Retry when time_until_allowed has elapsed. | 138 // TODO(oysteine): Retry when time_until_allowed has elapsed. |
136 if (config && delegate_ && | 139 if (config && delegate_ && |
137 !delegate_->IsAllowedToBeginBackgroundScenario( | 140 !delegate_->IsAllowedToBeginBackgroundScenario( |
138 *config.get(), requires_anonymized_data)) { | 141 *config.get(), requires_anonymized_data)) { |
139 return false; | 142 return false; |
140 } | 143 } |
141 } else { | 144 } else { |
142 base::MessageLoop::current()->PostTask( | 145 base::ThreadTaskRunnerHandle::Get()->PostTask( |
143 FROM_HERE, | 146 FROM_HERE, |
144 base::Bind(&BackgroundTracingManagerImpl::ValidateStartupScenario, | 147 base::Bind(&BackgroundTracingManagerImpl::ValidateStartupScenario, |
145 base::Unretained(this))); | 148 base::Unretained(this))); |
146 } | 149 } |
147 | 150 |
148 std::unique_ptr<const content::BackgroundTracingConfigImpl> config_impl( | 151 std::unique_ptr<const content::BackgroundTracingConfigImpl> config_impl( |
149 static_cast<BackgroundTracingConfigImpl*>(config.release())); | 152 static_cast<BackgroundTracingConfigImpl*>(config.release())); |
150 | 153 |
151 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 154 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
152 | 155 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: | 551 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: |
549 return "blink_style"; | 552 return "blink_style"; |
550 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: | 553 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: |
551 NOTREACHED(); | 554 NOTREACHED(); |
552 } | 555 } |
553 NOTREACHED(); | 556 NOTREACHED(); |
554 return ""; | 557 return ""; |
555 } | 558 } |
556 | 559 |
557 } // namspace content | 560 } // namspace content |
OLD | NEW |