Used for thread checking and debugging. Meant to be as fast as possible. These are produced by PlatformThread::CurrentRef(), and used to later check if we are on the same thread or not by using ==. These are safe to copy between threads, but can't be copied to another process as they have no meaning there. Also, the internal identifier can be re-used after a thread dies, so a PlatformThreadRef can
| 66 | // after a thread dies, so a PlatformThreadRef cannot be reliably used |
| 67 | // to distinguish a new thread from an old, dead thread. |
| 68 | class PlatformThreadRef { |
| 69 | public: |
| 70 | typedef cef_platform_thread_handle_t RefType; |
| 71 | |
| 72 | PlatformThreadRef() : id_(0) {} |
| 73 | |
| 74 | explicit PlatformThreadRef(RefType id) : id_(id) {} |
| 75 | |
| 76 | bool operator==(PlatformThreadRef other) const { return id_ == other.id_; } |
| 77 | |
| 78 | bool is_null() const { return id_ == 0; } |
| 79 | |
| 80 | private: |
| 81 | RefType id_; |
| 82 | }; |
| 83 | |
| 84 | // A namespace for low-level thread functions. |
| 85 | // Chromium uses a class with static methods but CEF uses an actual namespace |