| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 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 COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_MARKER_H_ | |
| 6 #define COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_MARKER_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 class SpellCheckMarker { | |
| 12 public: | |
| 13 // A predicate to test spellcheck marker validity. | |
| 14 class IsValidPredicate { | |
| 15 public: | |
| 16 typedef SpellCheckMarker argument_type; | |
| 17 explicit IsValidPredicate(size_t text_length) : text_length_(text_length) {} | |
| 18 bool operator()(const SpellCheckMarker& marker) const { | |
| 19 return marker.offset < text_length_; | |
| 20 } | |
| 21 | |
| 22 private: | |
| 23 size_t text_length_; | |
| 24 }; | |
| 25 | |
| 26 // IPC requires a default constructor. | |
| 27 SpellCheckMarker() : hash(0xFFFFFFFF), offset(UINT32_MAX) {} | |
| 28 | |
| 29 SpellCheckMarker(uint32_t hash, uint32_t offset) | |
| 30 : hash(hash), offset(offset) {} | |
| 31 | |
| 32 uint32_t hash; | |
| 33 // Note: we use uint32_t instead of size_t because this struct is sent over | |
| 34 // IPC which could span 32 & 64 bit processes. This is fine since the offset | |
| 35 // shouldn't exceed UINT32_MAX even on 64 bit builds. | |
| 36 uint32_t offset; | |
| 37 }; | |
| 38 | |
| 39 #endif // COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_MARKER_H_ | |
| OLD | NEW |