Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef BASE_SINGLE_THREAD_TASK_RUNNER_H_ |
michael@0 | 6 | #define BASE_SINGLE_THREAD_TASK_RUNNER_H_ |
michael@0 | 7 | |
michael@0 | 8 | #include "base/base_export.h" |
michael@0 | 9 | #include "base/sequenced_task_runner.h" |
michael@0 | 10 | |
michael@0 | 11 | namespace base { |
michael@0 | 12 | |
michael@0 | 13 | // A SingleThreadTaskRunner is a SequencedTaskRunner with one more |
michael@0 | 14 | // guarantee; namely, that all tasks are run on a single dedicated |
michael@0 | 15 | // thread. Most use cases require only a SequencedTaskRunner, unless |
michael@0 | 16 | // there is a specific need to run tasks on only a single thread. |
michael@0 | 17 | // |
michael@0 | 18 | // SingleThreadTaskRunner implementations might: |
michael@0 | 19 | // - Post tasks to an existing thread's MessageLoop (see MessageLoopProxy). |
michael@0 | 20 | // - Create their own worker thread and MessageLoop to post tasks to. |
michael@0 | 21 | // - Add tasks to a FIFO and signal to a non-MessageLoop thread for them to |
michael@0 | 22 | // be processed. This allows TaskRunner-oriented code run on threads |
michael@0 | 23 | // running other kinds of message loop, e.g. Jingle threads. |
michael@0 | 24 | class BASE_EXPORT SingleThreadTaskRunner : public SequencedTaskRunner { |
michael@0 | 25 | public: |
michael@0 | 26 | // A more explicit alias to RunsTasksOnCurrentThread(). |
michael@0 | 27 | bool BelongsToCurrentThread() const { |
michael@0 | 28 | return RunsTasksOnCurrentThread(); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | protected: |
michael@0 | 32 | virtual ~SingleThreadTaskRunner() {} |
michael@0 | 33 | }; |
michael@0 | 34 | |
michael@0 | 35 | } // namespace base |
michael@0 | 36 | |
michael@0 | 37 | #endif // BASE_SINGLE_THREAD_TASK_RUNNER_H_ |