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

Unified Diff: base/thread_task_runner_handle.h

Issue 10380016: Add base::ThreadTaskRunner class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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: base/thread_task_runner_handle.h
diff --git a/base/thread_task_runner_handle.h b/base/thread_task_runner_handle.h
new file mode 100644
index 0000000000000000000000000000000000000000..17685961e99d8c8a975a612f3f633405cd093b4b
--- /dev/null
+++ b/base/thread_task_runner_handle.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_THREAD_TASK_RUNNER_HANDLE_H_
+#define BASE_THREAD_TASK_RUNNER_HANDLE_H_
+
+#include "base/base_export.h"
+#include "base/memory/ref_counted.h"
+
+namespace base {
+
+class SingleThreadTaskRunner;
+
+// ThreadTaskRunner stores reference to the main task runner for each
Ami GONE FROM CHROMIUM 2012/05/08 01:30:14 s/stores/stores a/
willchan no longer on Chromium 2012/05/08 02:35:06 s/ThreadTaskRunner/ThreadTaskRunnerHandle/
Sergey Ulanov 2012/05/09 18:34:11 Done.
Sergey Ulanov 2012/05/09 18:34:11 Done.
+// thread. Not more than one of these objects created per
Ami GONE FROM CHROMIUM 2012/05/08 01:30:14 s/created/can be created/
Sergey Ulanov 2012/05/09 18:34:11 Done.
Sergey Ulanov 2012/05/09 18:34:11 Done.
+// thread. After an instance of this object is created the Get()
+// function will be returning the |task_runner| specified in the
Ami GONE FROM CHROMIUM 2012/05/08 01:30:14 s/be returning/return/
Sergey Ulanov 2012/05/09 18:34:11 Done.
+// constructor.
+class BASE_EXPORT ThreadTaskRunnerHandle {
+ public:
+ // Gets the SingleThreadTaskRunner for the current thread.
+ static scoped_refptr<SingleThreadTaskRunner> Get();
+
+ ThreadTaskRunnerHandle(
+ const scoped_refptr<SingleThreadTaskRunner>& task_runner);
+ ~ThreadTaskRunnerHandle();
+
+ private:
+ scoped_refptr<SingleThreadTaskRunner> task_runner_;
+};
+
+} // namespace base
+
+#endif // BASE_THREAD_TASK_RUNNER_HANDLE_H_

Powered by Google App Engine
This is Rietveld 408576698