Chromium Code Reviews| Index: src/lexer/experimental-scanner.cc |
| diff --git a/src/icu_util.cc b/src/lexer/experimental-scanner.cc |
| similarity index 62% |
| copy from src/icu_util.cc |
| copy to src/lexer/experimental-scanner.cc |
| index b9bd65edc69ecb680a9cae4efc96ed3158543285..01d62e3619d709afcec129e47914a4e644ee43ac 100644 |
| --- a/src/icu_util.cc |
| +++ b/src/lexer/experimental-scanner.cc |
| @@ -25,38 +25,41 @@ |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| -#include "icu_util.h" |
| +#include "experimental-scanner.h" |
| -#if defined(_WIN32) && defined(V8_I18N_SUPPORT) |
| -#include <windows.h> |
| +namespace v8 { |
| +namespace internal { |
| -#include "unicode/putil.h" |
| -#include "unicode/udata.h" |
| +std::set<ScannerBase*>* ScannerBase::scanners_ = NULL; |
| -#define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat" |
| -#define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt.dll" |
| -#endif |
| +void ScannerBase::UpdateBuffersAfterGC(v8::Isolate*, GCType, GCCallbackFlags) { |
| + if (!scanners_) |
|
ulan
2013/11/26 13:15:47
Either one line "if (!scanners_) return;" or add b
marja
2013/11/26 13:35:05
Done.
|
| + return; |
| + for (std::set<ScannerBase*>::const_iterator it = scanners_->begin(); |
| + it != scanners_->end(); |
| + ++it) |
| + (*it)->SetBufferBasedOnHandle(); |
| +} |
| -namespace v8 { |
| +template<> |
| +const uint8_t* ExperimentalScanner<uint8_t>::GetNewBufferBasedOnHandle() const { |
| + String::FlatContent content = source_handle_->GetFlatContent(); |
| + return content.ToOneByteVector().start(); |
| +} |
| + |
| +template <> |
|
ulan
2013/11/26 13:15:47
Separate functions with two empty lines.
marja
2013/11/26 13:35:05
Done.
|
| +const uint16_t* ExperimentalScanner<uint16_t>::GetNewBufferBasedOnHandle() |
| + const { |
| + String::FlatContent content = source_handle_->GetFlatContent(); |
| + return content.ToUC16Vector().start(); |
| +} |
| -namespace internal { |
| -bool InitializeICU() { |
| -#if defined(_WIN32) && defined(V8_I18N_SUPPORT) |
| - // We expect to find the ICU data module alongside the current module. |
| - HMODULE module = LoadLibraryA(ICU_UTIL_DATA_SHARED_MODULE_NAME); |
| - if (!module) return false; |
| - |
| - FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL); |
| - if (!addr) return false; |
| - |
| - UErrorCode err = U_ZERO_ERROR; |
| - udata_setCommonData(reinterpret_cast<void*>(addr), &err); |
| - return err == U_ZERO_ERROR; |
| -#else |
| - // Mac/Linux bundle the ICU data in. |
| - return true; |
| -#endif |
| +template<> |
| +const int8_t* ExperimentalScanner<int8_t>::GetNewBufferBasedOnHandle() const { |
| + String::FlatContent content = source_handle_->GetFlatContent(); |
| + return reinterpret_cast<const int8_t*>(content.ToOneByteVector().start()); |
| } |
| -} } // namespace v8::internal |
| +} |
| +} |