Chromium Code Reviews| Index: content/browser/renderer_host/pepper/pepper_file_message_filter.cc |
| diff --git a/content/browser/renderer_host/pepper/pepper_file_message_filter.cc b/content/browser/renderer_host/pepper/pepper_file_message_filter.cc |
| index 5de7fbf19fcda606694d66f38d7f78e7f1cf80e5..9a431dcd86f94782592aac490dcef1225e3d7359 100644 |
| --- a/content/browser/renderer_host/pepper/pepper_file_message_filter.cc |
| +++ b/content/browser/renderer_host/pepper/pepper_file_message_filter.cc |
| @@ -8,8 +8,10 @@ |
| #include "base/file_path.h" |
| #include "base/file_util.h" |
| #include "base/logging.h" |
| +#include "base/metrics/field_trial.h" |
| #include "base/platform_file.h" |
| #include "base/process_util.h" |
| +#include "base/threading/sequenced_worker_pool.h" |
| #include "content/browser/child_process_security_policy_impl.h" |
| #include "content/browser/renderer_host/render_process_host_impl.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -60,6 +62,29 @@ IPC::PlatformFileForTransit PlatformFileToPlatformFileForTransit( |
| return file; |
| } |
| +// TODO(shess): http://crbug.com/153383 debugging. This is only |
| +// necessary while determining if (and how much) worker pool mitigates |
| +// the problem. |
| +bool UseFileThread() { |
| + static bool use_file_thread = true; |
| + |
| + static bool activated = false; |
| + if (!activated) { |
| + // NOTE(shess): These need to match the values in pepper_flash.cc. |
| + // Since this code is only temporary, it is not worth plumbing |
| + // shared access through. |
| + const char* const kFieldTrialName = "FlapperIOThread"; |
| + const char* const kFileGroupName = "FileThread"; |
| + |
| + std::string active = base::FieldTrialList::FindFullName(kFieldTrialName); |
| + use_file_thread = (active == kFileGroupName); |
| + |
| + activated = true; |
| + } |
| + |
| + return use_file_thread; |
| +} |
| + |
| } // namespace |
| PepperFileMessageFilter::PepperFileMessageFilter(int child_id) |
| @@ -70,10 +95,20 @@ PepperFileMessageFilter::PepperFileMessageFilter(int child_id) |
| void PepperFileMessageFilter::OverrideThreadForMessage( |
| const IPC::Message& message, |
| BrowserThread::ID* thread) { |
| - if (IPC_MESSAGE_CLASS(message) == PepperFileMsgStart) |
| + if (IPC_MESSAGE_CLASS(message) == PepperFileMsgStart && UseFileThread()) |
| *thread = BrowserThread::FILE; |
| } |
| +base::TaskRunner* PepperFileMessageFilter::OverrideTaskRunnerForMessage( |
| + const IPC::Message& message) { |
| + if (IPC_MESSAGE_CLASS(message) == PepperFileMsgStart) { |
| + // Should never get here if using the FILE thread. |
| + DCHECK(!UseFileThread()); |
| + return BrowserThread::GetBlockingPool(); |
|
yzshen1
2012/10/02 23:33:44
According to the comments of GetBlockingPool(), th
Scott Hess - ex-Googler
2012/10/02 23:42:31
I'll talk to Brett.
yzshen1
2012/10/02 23:52:10
I am very curious about the result. Please let me
|
| + } |
| + return NULL; |
| +} |
| + |
| bool PepperFileMessageFilter::OnMessageReceived(const IPC::Message& message, |
| bool* message_was_ok) { |
| bool handled = true; |