| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 REMOTING_CLIENT_QUEUED_TASK_POSTER_H_ | 5 #ifndef REMOTING_CLIENT_QUEUED_TASK_POSTER_H_ |
| 6 #define REMOTING_CLIENT_QUEUED_TASK_POSTER_H_ | 6 #define REMOTING_CLIENT_QUEUED_TASK_POSTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <queue> | 9 #include <queue> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/single_thread_task_runner.h" |
| 14 | 16 |
| 15 namespace remoting { | 17 namespace remoting { |
| 16 | 18 |
| 17 // This is a helper class ensuring tasks posted to |target_task_runner| inside | 19 // This is a helper class ensuring tasks posted to |target_task_runner| inside |
| 18 // the same task slot will be queued up and executed together after current | 20 // the same task slot will be queued up and executed together after current |
| 19 // task is done on |source_task_runner|. This can prevent unrelated tasks to | 21 // task is done on |source_task_runner|. This can prevent unrelated tasks to |
| 20 // be scheduled on |target_task_runner| in between the task sequence. | 22 // be scheduled on |target_task_runner| in between the task sequence. |
| 21 // This class can be created on any thread but must be used and deleted on the | 23 // This class can be created on any thread but must be used and deleted on the |
| 22 // thread of |source_task_runner|. | 24 // thread of |source_task_runner|. |
| 23 class QueuedTaskPoster { | 25 class QueuedTaskPoster { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 bool transfer_task_scheduled_ = false; | 41 bool transfer_task_scheduled_ = false; |
| 40 | 42 |
| 41 base::WeakPtrFactory<QueuedTaskPoster> weak_factory_; | 43 base::WeakPtrFactory<QueuedTaskPoster> weak_factory_; |
| 42 | 44 |
| 43 DISALLOW_COPY_AND_ASSIGN(QueuedTaskPoster); | 45 DISALLOW_COPY_AND_ASSIGN(QueuedTaskPoster); |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespace remoting | 48 } // namespace remoting |
| 47 | 49 |
| 48 #endif // REMOTING_CLIENT_QUEUED_TASK_POSTER_H_ | 50 #endif // REMOTING_CLIENT_QUEUED_TASK_POSTER_H_ |
| OLD | NEW |