Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: src/extensions/i18n/collator.cc

Issue 18509003: Keep two empty lines between declarations for cpp files (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/extensions/i18n/break-iterator.cc ('k') | src/extensions/i18n/i18n-extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // this method is used as the weak callback for persistent handles not 69 // this method is used as the weak callback for persistent handles not
70 // pointing to a collator. 70 // pointing to a collator.
71 v8::HandleScope handle_scope(isolate); 71 v8::HandleScope handle_scope(isolate);
72 v8::Local<v8::Object> handle = v8::Local<v8::Object>::New(isolate, *object); 72 v8::Local<v8::Object> handle = v8::Local<v8::Object>::New(isolate, *object);
73 delete UnpackCollator(handle); 73 delete UnpackCollator(handle);
74 74
75 // Then dispose of the persistent handle to JS object. 75 // Then dispose of the persistent handle to JS object.
76 object->Dispose(isolate); 76 object->Dispose(isolate);
77 } 77 }
78 78
79
79 // Throws a JavaScript exception. 80 // Throws a JavaScript exception.
80 static v8::Handle<v8::Value> ThrowUnexpectedObjectError() { 81 static v8::Handle<v8::Value> ThrowUnexpectedObjectError() {
81 // Returns undefined, and schedules an exception to be thrown. 82 // Returns undefined, and schedules an exception to be thrown.
82 return v8::ThrowException(v8::Exception::Error( 83 return v8::ThrowException(v8::Exception::Error(
83 v8::String::New("Collator method called on an object " 84 v8::String::New("Collator method called on an object "
84 "that is not a Collator."))); 85 "that is not a Collator.")));
85 } 86 }
86 87
88
87 // When there's an ICU error, throw a JavaScript error with |message|. 89 // When there's an ICU error, throw a JavaScript error with |message|.
88 static v8::Handle<v8::Value> ThrowExceptionForICUError(const char* message) { 90 static v8::Handle<v8::Value> ThrowExceptionForICUError(const char* message) {
89 return v8::ThrowException(v8::Exception::Error(v8::String::New(message))); 91 return v8::ThrowException(v8::Exception::Error(v8::String::New(message)));
90 } 92 }
91 93
94
92 // static 95 // static
93 void Collator::JSInternalCompare( 96 void Collator::JSInternalCompare(
94 const v8::FunctionCallbackInfo<v8::Value>& args) { 97 const v8::FunctionCallbackInfo<v8::Value>& args) {
95 if (args.Length() != 3 || !args[0]->IsObject() || 98 if (args.Length() != 3 || !args[0]->IsObject() ||
96 !args[1]->IsString() || !args[2]->IsString()) { 99 !args[1]->IsString() || !args[2]->IsString()) {
97 v8::ThrowException(v8::Exception::SyntaxError( 100 v8::ThrowException(v8::Exception::SyntaxError(
98 v8::String::New("Collator and two string arguments are required."))); 101 v8::String::New("Collator and two string arguments are required.")));
99 return; 102 return;
100 } 103 }
101 104
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 v8::Handle<v8::Object> resolved) { 357 v8::Handle<v8::Object> resolved) {
355 UErrorCode status = U_ZERO_ERROR; 358 UErrorCode status = U_ZERO_ERROR;
356 if (UCOL_ON == collator->getAttribute(attribute, status)) { 359 if (UCOL_ON == collator->getAttribute(attribute, status)) {
357 resolved->Set(v8::String::New(property), v8::Boolean::New(true)); 360 resolved->Set(v8::String::New(property), v8::Boolean::New(true));
358 } else { 361 } else {
359 resolved->Set(v8::String::New(property), v8::Boolean::New(false)); 362 resolved->Set(v8::String::New(property), v8::Boolean::New(false));
360 } 363 }
361 } 364 }
362 365
363 } // namespace v8_i18n 366 } // namespace v8_i18n
OLDNEW
« no previous file with comments | « src/extensions/i18n/break-iterator.cc ('k') | src/extensions/i18n/i18n-extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698