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

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

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 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/experimental/collator.h ('k') | src/extensions/experimental/datetime-format.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "collator.h" 28 #include "src/extensions/experimental/collator.h"
29 29
30 #include "unicode/coll.h" 30 #include "unicode/coll.h"
31 #include "unicode/locid.h" 31 #include "unicode/locid.h"
32 #include "unicode/ucol.h" 32 #include "unicode/ucol.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 v8::Persistent<v8::FunctionTemplate> Collator::collator_template_; 37 v8::Persistent<v8::FunctionTemplate> Collator::collator_template_;
38 38
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // by a caller in JavaScript. Otherwise, we don't touch because 146 // by a caller in JavaScript. Otherwise, we don't touch because
147 // we don't want to change the locale-dependent default value. 147 // we don't want to change the locale-dependent default value.
148 // The three options below are very likely to have the same default 148 // The three options below are very likely to have the same default
149 // across locales, but I haven't checked them all. Others we may add 149 // across locales, but I haven't checked them all. Others we may add
150 // in the future have certainly locale-dependent default (e.g. 150 // in the future have certainly locale-dependent default (e.g.
151 // caseFirst is upperFirst for Danish while is off for most other locales). 151 // caseFirst is upperFirst for Danish while is off for most other locales).
152 152
153 bool ignore_case, ignore_accents, numeric; 153 bool ignore_case, ignore_accents, numeric;
154 154
155 if (ExtractBooleanOption(options, "ignoreCase", &ignore_case)) { 155 if (ExtractBooleanOption(options, "ignoreCase", &ignore_case)) {
156 // We need to explicitly set the level to secondary to get case ignored.
157 // The default L3 ignores UCOL_CASE_LEVEL == UCOL_OFF !
158 if (ignore_case) {
159 collator->setStrength(icu::Collator::SECONDARY);
160 }
156 collator->setAttribute(UCOL_CASE_LEVEL, ignore_case ? UCOL_OFF : UCOL_ON, 161 collator->setAttribute(UCOL_CASE_LEVEL, ignore_case ? UCOL_OFF : UCOL_ON,
157 status); 162 status);
158 if (U_FAILURE(status)) { 163 if (U_FAILURE(status)) {
159 delete collator; 164 delete collator;
160 return ThrowExceptionForICUError("Failed to set ignoreCase."); 165 return ThrowExceptionForICUError("Failed to set ignoreCase.");
161 } 166 }
162 } 167 }
163 168
164 // Accents are taken into account with strength secondary or higher. 169 // Accents are taken into account with strength secondary or higher.
165 if (ExtractBooleanOption(options, "ignoreAccents", &ignore_accents)) { 170 if (ExtractBooleanOption(options, "ignoreAccents", &ignore_accents)) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Set collator as internal field of the resulting JS object. 213 // Set collator as internal field of the resulting JS object.
209 wrapper->SetPointerInInternalField(0, collator); 214 wrapper->SetPointerInInternalField(0, collator);
210 215
211 // Make object handle weak so we can delete iterator once GC kicks in. 216 // Make object handle weak so we can delete iterator once GC kicks in.
212 wrapper.MakeWeak(NULL, DeleteCollator); 217 wrapper.MakeWeak(NULL, DeleteCollator);
213 218
214 return wrapper; 219 return wrapper;
215 } 220 }
216 221
217 } } // namespace v8::internal 222 } } // namespace v8::internal
218
OLDNEW
« no previous file with comments | « src/extensions/experimental/collator.h ('k') | src/extensions/experimental/datetime-format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698