OLD | NEW |
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 CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__ |
6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__ | 6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Detach the PrintJobWorker associated to this object. | 37 // Detach the PrintJobWorker associated to this object. |
38 virtual std::unique_ptr<PrintJobWorker> DetachWorker( | 38 virtual std::unique_ptr<PrintJobWorker> DetachWorker( |
39 PrintJobWorkerOwner* new_owner) = 0; | 39 PrintJobWorkerOwner* new_owner) = 0; |
40 | 40 |
41 // Access the current settings. | 41 // Access the current settings. |
42 virtual const PrintSettings& settings() const = 0; | 42 virtual const PrintSettings& settings() const = 0; |
43 | 43 |
44 // Cookie uniquely identifying the PrintedDocument and/or loaded settings. | 44 // Cookie uniquely identifying the PrintedDocument and/or loaded settings. |
45 virtual int cookie() const = 0; | 45 virtual int cookie() const = 0; |
46 | 46 |
47 // Returns true if the current thread is a thread on which a task | 47 // Returns true if tasks posted to this TaskRunner are sequenced |
48 // may be run, and false if no task will be run on the current | 48 // with this call. |
49 // thread. | 49 bool RunsTasksInCurrentSequence() const; |
50 bool RunsTasksOnCurrentThread() const; | |
51 | 50 |
52 // Posts the given task to be run. | 51 // Posts the given task to be run. |
53 bool PostTask(const tracked_objects::Location& from_here, | 52 bool PostTask(const tracked_objects::Location& from_here, |
54 const base::Closure& task); | 53 const base::Closure& task); |
55 | 54 |
56 protected: | 55 protected: |
57 friend class base::RefCountedThreadSafe<PrintJobWorkerOwner>; | 56 friend class base::RefCountedThreadSafe<PrintJobWorkerOwner>; |
58 | 57 |
59 virtual ~PrintJobWorkerOwner(); | 58 virtual ~PrintJobWorkerOwner(); |
60 | 59 |
61 // Task runner reference. Used to send notifications in the right | 60 // Task runner reference. Used to send notifications in the right |
62 // thread. | 61 // thread. |
63 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 62 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
64 }; | 63 }; |
65 | 64 |
66 } // namespace printing | 65 } // namespace printing |
67 | 66 |
68 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__ | 67 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__ |
OLD | NEW |