| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ | 5 #ifndef CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ |
| 6 #define CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ | 6 #define CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ |
| 7 | 7 |
| 8 #include "base/mac/scoped_mach_port.h" | 8 #include "base/mac/scoped_mach_port.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Set the service Mach port. Ownership of |service_port| is passed to the | 32 // Set the service Mach port. Ownership of |service_port| is passed to the |
| 33 // manager. | 33 // manager. |
| 34 void set_service_port(mach_port_t service_port) { | 34 void set_service_port(mach_port_t service_port) { |
| 35 service_port_.reset(service_port); | 35 service_port_.reset(service_port); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Set the token used when communicating with the Mach service. | 38 // Set the token used when communicating with the Mach service. |
| 39 void set_token(const IOSurfaceManagerToken& token) { | 39 void set_token(const IOSurfaceManagerToken& token) { |
| 40 token_ = token; | 40 token_ = token; |
| 41 #if !defined(NDEBUG) | 41 #if DCHECK_IS_ON() |
| 42 set_token_thread_id_ = base::PlatformThread::CurrentRef(); | 42 set_token_thread_id_ = base::PlatformThread::CurrentRef(); |
| 43 #endif | 43 #endif |
| 44 set_token_event_.Signal(); | 44 set_token_event_.Signal(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 friend struct DefaultSingletonTraits<ChildIOSurfaceManager>; | 48 friend struct DefaultSingletonTraits<ChildIOSurfaceManager>; |
| 49 | 49 |
| 50 ChildIOSurfaceManager(); | 50 ChildIOSurfaceManager(); |
| 51 ~ChildIOSurfaceManager() override; | 51 ~ChildIOSurfaceManager() override; |
| 52 | 52 |
| 53 base::mac::ScopedMachSendRight service_port_; | 53 base::mac::ScopedMachSendRight service_port_; |
| 54 IOSurfaceManagerToken token_; | 54 IOSurfaceManagerToken token_; |
| 55 #if !defined(NDEBUG) | 55 #if DCHECK_IS_ON() |
| 56 base::PlatformThreadRef set_token_thread_id_; | 56 base::PlatformThreadRef set_token_thread_id_; |
| 57 #endif | 57 #endif |
| 58 base::WaitableEvent set_token_event_; | 58 base::WaitableEvent set_token_event_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(ChildIOSurfaceManager); | 60 DISALLOW_COPY_AND_ASSIGN(ChildIOSurfaceManager); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace content | 63 } // namespace content |
| 64 | 64 |
| 65 #endif // CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ | 65 #endif // CONTENT_CHILD_CHILD_IO_SURFACE_MANAGER_MAC_H_ |
| OLD | NEW |