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

Side by Side Diff: base/task.h

Issue 7062013: Move media library AutoTaskRunner to base and rename ScopedTaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/task.cc » ('j') | base/task.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_TASK_H_ 5 #ifndef BASE_TASK_H_
6 #define BASE_TASK_H_ 6 #define BASE_TASK_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/base_api.h" 9 #include "base/base_api.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 539
540 template <class Function, class A, class B, class C, class D, class E, 540 template <class Function, class A, class B, class C, class D, class E,
541 class F, class G, class H> 541 class F, class G, class H>
542 inline Task* NewRunnableFunction(Function function, const A& a, const B& b, 542 inline Task* NewRunnableFunction(Function function, const A& a, const B& b,
543 const C& c, const D& d, const E& e, const F& f, 543 const C& c, const D& d, const E& e, const F& f,
544 const G& g, const H& h) { 544 const G& g, const H& h) {
545 return new RunnableFunction<Function, Tuple8<A, B, C, D, E, F, G, H> >( 545 return new RunnableFunction<Function, Tuple8<A, B, C, D, E, F, G, H> >(
546 function, MakeTuple(a, b, c, d, e, f, g, h)); 546 function, MakeTuple(a, b, c, d, e, f, g, h));
547 } 547 }
548 548
549 // ScopedTaskRunner is akin to scoped_ptr for Tasks. It ensures that the Task
550 // is executed and deleted no matter how the current scope exits.
551 class ScopedTaskRunner {
awong 2011/05/26 02:51:38 Should this be thrown into the namespace base? I
brettw 2011/05/26 17:17:22 I agree that using the base namespace is a good id
Wez 2011/05/26 18:48:21 Done.
552 public:
553 // Takes ownership of the task.
554 explicit ScopedTaskRunner(Task* task) : task_(task) {}
awong 2011/05/26 02:51:38 Since we're out-of-lining the destructor, might as
Wez 2011/05/26 18:48:21 Done.
555
556 ~ScopedTaskRunner();
557
558 Task* release() { Task* tmp = task_; task_ = NULL; return tmp; }
brettw 2011/05/26 17:17:22 I think out-of-lining is also good for this (shoul
Wez 2011/05/26 18:48:21 Done.
559
560 private:
561 Task* task_;
562
563 DISALLOW_COPY_AND_ASSIGN(ScopedTaskRunner);
scherkus (not reviewing) 2011/05/26 02:57:16 micro-nit: DISALLOW_IMPLICIT_CONSTRUCTORS
Wez 2011/05/26 18:48:21 Done.
564 };
565
549 #endif // BASE_TASK_H_ 566 #endif // BASE_TASK_H_
OLDNEW
« no previous file with comments | « no previous file | base/task.cc » ('j') | base/task.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698