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

Unified Diff: content/browser/renderer_host/pepper/pepper_file_message_filter.cc

Issue 11016016: Flapper field trial to use workerpool for sync file operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix group check for browser_tests. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698