| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_HANDLER_H_ | |
| 6 #define MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_HANDLER_H_ | |
| 7 | |
| 8 #include <mojo/result.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include "mojo/public/cpp/system/handle.h" | |
| 12 | |
| 13 namespace mojo { | |
| 14 | |
| 15 // Used by RunLoop to notify when a handle is either ready or has become | |
| 16 // invalid. | |
| 17 class RunLoopHandler { | |
| 18 public: | |
| 19 using Id = uint64_t; | |
| 20 | |
| 21 // Called when wait for the handle is ready (i.e., waiting yields | |
| 22 // MOJO_RESULT_OK). | |
| 23 virtual void OnHandleReady(Id id) = 0; | |
| 24 | |
| 25 // Called when waiting for the handle is no longer valid (i.e., waiting yields | |
| 26 // the error |result|). This is also called with MOJO_RESULT_ABORTED if the | |
| 27 // RunLoop is destroyed. | |
| 28 virtual void OnHandleError(Id id, MojoResult result) = 0; | |
| 29 | |
| 30 protected: | |
| 31 virtual ~RunLoopHandler() {} | |
| 32 }; | |
| 33 | |
| 34 } // namespace mojo | |
| 35 | |
| 36 #endif // MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_HANDLER_H_ | |
| OLD | NEW |