[GTK] RunLoop constructor should properly retrieve or establish the thread-default...
[WebKit-https.git] / Source / WTF / ChangeLog
1 2015-05-14  Žan Doberšek  <zdobersek@igalia.com>
2
3         [GTK] RunLoop constructor should properly retrieve or establish the thread-default GMainContext
4         https://bugs.webkit.org/show_bug.cgi?id=144732
5
6         Reviewed by Carlos Garcia Campos.
7
8         RunLoop constructor in the GTK implementation should use the
9         existing thread-default context, create a new one if not on
10         the main thread, or use the global-default one if on the main
11         thread.
12
13         In RunLoop::run(), the GMainContext should then be pushed as
14         the thread-default before calling g_main_loop_run(), and popped
15         off when the main loop stops.
16
17         * wtf/gtk/RunLoopGtk.cpp:
18         (WTF::RunLoop::RunLoop):
19         (WTF::RunLoop::run):
20
21 2015-05-13  Oliver Hunt  <oliver@apple.com>
22        Ensure that all the smart pointer types in WTF clear their pointer before deref
23        https://bugs.webkit.org/show_bug.cgi?id=143789
24
25        Reviewed by Ryosuke Niwa.
26
27        In order to prevent use after free bugs caused by destructors
28        that end up trying to access the smart pointer itself, we should
29        make sure we always clear the m_ptr field before calling deref.
30
31        Essentially the UaF path is:
32        struct Foo : RefCounted<Foo> {
33          Wibble* m_wibble;
34          void doSomething();
35          ~Foo() { m_wibble->doSomethingLikeCleanup(); }
36        };
37
38        struct Wibble {
39          void doSomethingLikeCleanup()
40          {
41            if (m_foo) {
42                /* if this branch is not here we get a null deref */
43                m_foo->doSomething();
44            }
45          }
46          void replaceFoo(Foo* foo) { m_foo = foo; }
47          RefPtr<Foo> m_foo;
48        };
49
50        Wibble* someWibble = /* a Wibble with m_foo->m_refCount == 1 */;
51                             /* and m_foo points to someWibble       */;
52
53        someWibble->replaceFoo(someOtherFoo);
54        + someWibble->m_foo->m_ptr->deref();
55          + someWibble->m_foo->m_ptr->~Foo()
56            + someWibble->m_foo->m_ptr->m_wibble->doSomethingLikeCleanup()
57              + someWibble->m_foo->m_ptr->m_wibble /* someWibble */ ->m_foo->m_ptr /*logically dead*/ ->doSomething()
58
59        By clearing m_ptr first we either force a null pointer deref or
60        we force our code down a path that does not use the dead smart
61        pointer.
62
63        * wtf/PassRefPtr.h:
64        (WTF::PassRefPtr::~PassRefPtr):
65        * wtf/Ref.h:
66        (WTF::Ref::~Ref):
67        (WTF::Ref::operator=):
68        * wtf/RefPtr.h:
69        (WTF::RefPtr::~RefPtr):
70        * wtf/RetainPtr.h:
71        (WTF::RetainPtr::~RetainPtr):
72        (WTF::RetainPtr<T>::clear):
73
74 2015-05-12  Michael Saboff  <msaboff@apple.com>
75
76         If JSC cannot get executable memory, it shouldn't call madvise
77         https://bugs.webkit.org/show_bug.cgi?id=144931
78
79         Reviewed by Mark Lam.
80
81         Made calling madvise conditional on really getting mmapped memory.
82
83         * wtf/OSAllocatorPosix.cpp:
84         (WTF::OSAllocator::reserveUncommitted):
85
86 2015-05-11  Brent Fulgham  <bfulgham@apple.com>
87
88         [Win] Move Windows build target to Windows 7 (or newer)
89         https://bugs.webkit.org/show_bug.cgi?id=144890
90         <rdar://problem/20707307>
91
92         Reviewed by Anders Carlsson.
93
94         Update linked SDK and minimal Windows level to be compatible with
95         Windows 7 or newer.
96
97         * WTF.vcxproj/WTF.vcxproj:
98         * WTF.vcxproj/WTFGenerated.vcxproj:
99         * config.h:
100
101 2015-05-11  Carlos Garcia Campos  <cgarcia@igalia.com>
102
103         [GTK] WorkQueue objects are not released
104         https://bugs.webkit.org/show_bug.cgi?id=144824
105
106         Reviewed by Žan Doberšek.
107
108         Do not keep a reference of the WorkQueue for the entire life of
109         its worker thread, since every task scheduled on the WorkQueue
110         already takes a reference. Instead, take a reference of the main
111         loop to make sure that when the worker thread starts, the main
112         loop hasn't been released to avoid runtime warnings (see
113         webkit.org/b/140998). Also removed the g_main_context_pop_thread_default()
114         from the thread body, since the thread-specific context queue will
115         be freed anyway when the thread exits.
116         If the WorkQueue is released early, before the thread has started,
117         schedule a main loop quit in the context, to make sure it will
118         be the first thing run by the main loop and the thread will exit.
119
120         * wtf/WorkQueue.h: Remove unused event loop mutex.
121         * wtf/gtk/WorkQueueGtk.cpp:
122         (WTF::WorkQueue::platformInitialize):
123         (WTF::WorkQueue::platformInvalidate):
124
125 2015-05-09  Yoav Weiss  <yoav@yoav.ws>
126
127         Remove the PICTURE_SIZES build flag
128         https://bugs.webkit.org/show_bug.cgi?id=144679
129
130         Reviewed by Benjamin Poulain.
131
132         Removed the PICTURE_SIZES build time flag.
133
134         * wtf/FeatureDefines.h:
135
136 2015-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
137
138         Remove convenience constructors for TextRun
139         https://bugs.webkit.org/show_bug.cgi?id=144752
140
141         Reviewed by Anders Carlsson.
142
143         No reason why StringView shouldn't have a StringImpl* constructor.
144
145         Test: StringView8Bit in TestWebKitAPI
146
147         * wtf/text/StringView.h: Add the constructor.
148
149 2015-05-08  Commit Queue  <commit-queue@webkit.org>
150
151         Unreviewed, rolling out r183996.
152         https://bugs.webkit.org/show_bug.cgi?id=144806
153
154         ASan detected use-after free (Requested by ap on #webkit).
155
156         Reverted changeset:
157
158         "Remove convenience constructors for TextRun"
159         https://bugs.webkit.org/show_bug.cgi?id=144752
160         http://trac.webkit.org/changeset/183996
161
162 2015-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
163
164         Remove convenience constructors for TextRun
165         https://bugs.webkit.org/show_bug.cgi?id=144752
166
167         Reviewed by Anders Carlsson.
168
169         No reason why StringView shouldn't have a StringImpl* constructor.
170
171         Test: StringView8Bit in TestWebKitAPI
172
173         * wtf/text/StringView.h: Add the constructor.
174
175 2015-05-08  Andreas Kling  <akling@apple.com>
176
177         Optimize serialization of quoted JSON strings.
178         <https://webkit.org/b/144754>
179
180         Reviewed by Darin Adler.
181
182         Add a StringBuilder API for appending a quoted JSON string. This is used by
183         JSON.stringify() to implement efficient appending of strings while escaping
184         quotes, control characters and \uNNNN-style characters.
185
186         The main benefit comes from only doing a single buffer expansion up front,
187         instead of doing it every time we append something. The fudge factor is pretty
188         large, since the maximum number of output characters per input character is 6.
189
190         The first landing of this patch had two bugs in it:
191
192         - Made \uNNNN escapes uppercase hexadecimal instead of lowercase.
193         - Didn't preallocate enough space for 8-bit input strings.
194
195         Both were caught by existing tests on our bots, and both were due to last-minute
196         changes before landing. :/
197
198         * wtf/text/StringBuilder.cpp:
199         (WTF::appendQuotedJSONStringInternal):
200         (WTF::StringBuilder::appendQuotedJSONString):
201         * wtf/text/StringBuilder.h:
202
203 2015-05-07  Commit Queue  <commit-queue@webkit.org>
204
205         Unreviewed, rolling out r183961.
206         https://bugs.webkit.org/show_bug.cgi?id=144784
207
208         Broke js/dom/JSON-stringify.html (Requested by kling on
209         #webkit).
210
211         Reverted changeset:
212
213         "Optimize serialization of quoted JSON strings."
214         https://bugs.webkit.org/show_bug.cgi?id=144754
215         http://trac.webkit.org/changeset/183961
216
217 2015-05-07  Andreas Kling  <akling@apple.com>
218
219         Optimize serialization of quoted JSON strings.
220         <https://webkit.org/b/144754>
221
222         Reviewed by Darin Adler.
223
224         Add a StringBuilder API for appending a quoted JSON string. This is used by
225         JSON.stringify() to implement efficient appending of strings while escaping
226         quotes, control characters and \uNNNN-style characters.
227
228         The main benefit comes from only doing a single buffer expansion up front,
229         instead of doing it every time we append something. The fudge factor is pretty
230         large for 16-bit strings, since the maximum number of output characters per
231         input character is 6.
232
233         * wtf/text/StringBuilder.cpp:
234         (WTF::appendQuotedJSONStringInternal):
235         (WTF::StringBuilder::appendQuotedJSONString):
236         * wtf/text/StringBuilder.h:
237
238 2015-05-07  Martin Robinson  <mrobinson@igalia.com>
239
240         [GTK] All spell checking layout tests fail
241         https://bugs.webkit.org/show_bug.cgi?id=144648
242
243         Reviewed by Carlos Garcia Campos.
244
245         * wtf/Platform.h: Activate UNIFIED_TEXT_CHECKING for GTK+.
246
247 2015-05-07  Dan Bernstein  <mitz@apple.com>
248
249         <rdar://problem/19317140> [Xcode] Remove usage of AspenFamily.xcconfig in Source/
250         https://bugs.webkit.org/show_bug.cgi?id=144727
251
252         Reviewed by Darin Adler.
253
254         * Configurations/Base.xcconfig: Don’t include AspenFamily.xcconfig, and define
255         INSTALL_PATH_PREFIX and LD_DYLIB_INSTALL_NAME for the iOS 8.x Simulator.
256
257 2015-05-07  Žan Doberšek  <zdobersek@igalia.com>
258
259         [GTK] Clean up RunLoop implementation
260         https://bugs.webkit.org/show_bug.cgi?id=144729
261
262         Reviewed by Carlos Garcia Campos.
263
264         Clean up the RunLoop implementation for the GTK port,
265         removing unnecessary methods and using simpler variable names.
266
267         Nested GMainLoops in RunLoop::run() are now created for the
268         RunLoop's GMainContext, and not for the default context (enforced
269         through the null argument to g_main_loop_new()).
270
271         * wtf/RunLoop.h:
272         * wtf/gtk/RunLoopGtk.cpp:
273         (WTF::RunLoop::RunLoop):
274         (WTF::RunLoop::~RunLoop):
275         (WTF::RunLoop::run):
276         (WTF::RunLoop::stop):
277         (WTF::RunLoop::wakeUp):
278         (WTF::RunLoop::TimerBase::start):
279         (WTF::RunLoop::innermostLoop): Deleted.
280         (WTF::RunLoop::pushNestedMainLoop): Deleted.
281         (WTF::RunLoop::popNestedMainLoop): Deleted.
282
283 2015-05-05  Carlos Garcia Campos  <cgarcia@igalia.com>
284
285         [GTK] Async operations running in the WorkQueue thread should schedule their sources to the WorkQueue main lopp
286         https://bugs.webkit.org/show_bug.cgi?id=144541
287
288         Reviewed by Žan Doberšek.
289
290         They are currently sent to the main thread run loop, because we
291         are not setting the WorkQueue main context as the default one in
292         the worker thread.
293
294         * wtf/gtk/WorkQueueGtk.cpp:
295         (WTF::WorkQueue::platformInitialize): Call
296         g_main_context_push_thread_default() to set the WorkQueue main
297         context as the default of the thread before running the main loop,
298         and g_main_context_pop_thread_default() when the main loop quits.
299
300 2015-05-04  Commit Queue  <commit-queue@webkit.org>
301
302         Unreviewed, rolling out r183661.
303         https://bugs.webkit.org/show_bug.cgi?id=144594
304
305         Caused ~3.5MB regression on membuster(!) (Requested by kling_
306         on #webkit).
307
308         Reverted changeset:
309
310         "Decrease minimum Vector size."
311         https://bugs.webkit.org/show_bug.cgi?id=144453
312         http://trac.webkit.org/changeset/183661
313
314 2015-05-04  Zan Dobersek  <zdobersek@igalia.com>
315
316         [WTF] Remove Functional.h inclusions
317         https://bugs.webkit.org/show_bug.cgi?id=144400
318
319         Reviewed by Darin Adler.
320
321         Remove most of the Functional.h header inclusions. The header is preserved
322         since it's still used by older versions of Safari, and for the callOnMainThread()
323         stub in DeprecatedSymbolsUsedBySafari.mm.
324
325         * wtf/MainThread.cpp:
326         * wtf/RunLoop.h:
327         * wtf/WorkQueue.cpp:
328         * wtf/WorkQueue.h:
329         * wtf/efl/DispatchQueueEfl.h:
330         * wtf/efl/DispatchQueueWorkItemEfl.h:
331
332 2015-05-02  Commit Queue  <commit-queue@webkit.org>
333
334         Unreviewed, rolling out r183722.
335         https://bugs.webkit.org/show_bug.cgi?id=144534
336
337         Made all the tests assert (Requested by ap on #webkit).
338
339         Reverted changeset:
340
341         "Generated static StringImpls should have static flag set."
342         https://bugs.webkit.org/show_bug.cgi?id=144516
343         http://trac.webkit.org/changeset/183722
344
345 2015-05-02  Andreas Kling  <akling@apple.com>
346
347         Generated static StringImpls should have static flag set.
348         <https://webkit.org/b/144516>
349
350         Reviewed by Darin Adler.
351
352         Discovered this while tracking down a string ref leak. Turns out that the strings
353         generated by StaticString.pm were not getting the static flag set on them.
354
355         The only practical difference from this AFAICT is that now the garbage collector
356         will correctly see that these strings have no extra memory cost to worry about.
357
358         * wtf/text/StringImpl.h:
359
360 2015-05-01  Martin Robinson  <mrobinson@igalia.com>
361
362         USE(...) macro should expect unprefixed variables
363         https://bugs.webkit.org/show_bug.cgi?id=144454
364
365         Reviewed by Daniel Bates.
366
367         * wtf/Assertions.cpp: Replace all occurrences WTF_USE with USE.
368         * wtf/Platform.h: Replace all occurrences WTF_USE with USE. Modify the USE
369         macro to look for unprefixed variables.
370         * wtf/WTFThreadData.h: Replace all occurrences WTF_USE with USE.
371
372 2015-05-01  Joseph Pecoraro  <pecoraro@apple.com>
373
374         Enable ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX by default on all ports (Windows was missed)
375         https://bugs.webkit.org/show_bug.cgi?id=144495
376
377         Reviewed by Csaba Osztrogonác.
378
379         * wtf/FeatureDefines.h:
380         This covers all ports that haven't defined the flag otherwise.
381
382 2015-04-30  Alex Christensen  <achristensen@webkit.org>
383
384         Decrease minimum Vector size.
385         https://bugs.webkit.org/show_bug.cgi?id=144453
386
387         Reviewed by Andreas Kling.
388
389         * wtf/Vector.h:
390         Make the default min size 4 to save memory on small Vectors.
391
392 2015-04-30  Yusuke Suzuki  <utatane.tea@gmail.com>
393
394         Use the default hash value for Symbolized StringImpl
395         https://bugs.webkit.org/show_bug.cgi?id=144347
396
397         Reviewed by Darin Adler.
398
399         Use a default hash value calculation for symbolized StringImpl.
400
401         * wtf/text/StringImpl.cpp:
402         (WTF::StringImpl::createSymbol):
403         * wtf/text/StringImpl.h:
404         (WTF::StringImpl::StringImpl):
405         (WTF::StringImpl::symbolAwareHash):
406         (WTF::StringImpl::existingSymbolAwareHash):
407         (WTF::StringImpl::hashForSymbol):
408         * wtf/text/StringStatics.cpp:
409         (WTF::StringImpl::nextHashForSymbol):
410         (WTF::StringImpl::hashAndFlagsForSymbol): Deleted.
411
412 2015-04-29  Alexey Proskuryakov  <ap@apple.com>
413
414         LazyNeverDestroyed is not thread safe in debug builds, causing assertions
415         https://bugs.webkit.org/show_bug.cgi?id=144378
416
417         Reviewed by Darin Adler.
418
419         * wtf/NeverDestroyed.h:
420
421 2015-04-28  Geoffrey Garen  <ggaren@apple.com>
422
423         It shouldn't take 1846 lines of code and 5 FIXMEs to sort an array.
424         https://bugs.webkit.org/show_bug.cgi?id=144013
425
426         Reviewed by Mark Lam.
427
428         Remove this custom tree implementation because it is unused. (It was
429         previously used to achieve a stable array sort in certain cases.)
430
431         * WTF.vcxproj/WTF.vcxproj:
432         * WTF.vcxproj/WTF.vcxproj.filters:
433         * WTF.xcodeproj/project.pbxproj:
434         * wtf/AVLTree.h: Removed.
435         * wtf/CMakeLists.txt:
436
437 2015-04-29  Myles C. Maxfield  <mmaxfield@apple.com>
438
439         [OS X] Use CTFontCreateForCSS instead of doing font search ourselves
440         https://bugs.webkit.org/show_bug.cgi?id=132159
441
442         Reviewed by Darin Adler.
443
444         * wtf/Platform.h:
445
446         Opt-in using ENABLE(PLATFORM_FONT_LOOKUP)
447
448 2015-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
449
450         REGRESSION (r183373): ASSERT failed in wtf/SHA1.h
451         https://bugs.webkit.org/show_bug.cgi?id=144257
452
453         Reviewed by Darin Adler.
454
455         * wtf/SHA1.h:
456         (WTF::SHA1::addBytes):
457
458 2015-04-29  Martin Robinson  <mrobinson@igalia.com>
459
460         [CMake] [GTK] Organize and clean up unused CMake variables
461         https://bugs.webkit.org/show_bug.cgi?id=144364
462
463         Reviewed by Gyuyoung Kim.
464
465         * wtf/PlatformGTK.cmake: Add variables specific to this project.
466
467 2015-04-28  Michael Catanzaro  <mcatanzaro@igalia.com>
468
469         Fully replace ENABLE_LLINT_C_LOOP with ENABLE_JIT
470         https://bugs.webkit.org/show_bug.cgi?id=144304
471
472         Reviewed by Geoffrey Garen.
473
474         No longer check ENABLE_LLINT_C_LOOP to determine the value of ENABLE_JIT.
475
476         * wtf/Platform.h:
477
478 2015-04-28  Commit Queue  <commit-queue@webkit.org>
479
480         Unreviewed, rolling out r183514.
481         https://bugs.webkit.org/show_bug.cgi?id=144359
482
483         It broke cloop test bots (Requested by mcatanzaro on #webkit).
484
485         Reverted changeset:
486
487         "Fully replace ENABLE_LLINT_C_LOOP with ENABLE_JIT"
488         https://bugs.webkit.org/show_bug.cgi?id=144304
489         http://trac.webkit.org/changeset/183514
490
491 2015-04-28  Michael Catanzaro  <mcatanzaro@igalia.com>
492
493         Fully replace ENABLE_LLINT_C_LOOP with ENABLE_JIT
494         https://bugs.webkit.org/show_bug.cgi?id=144304
495
496         Reviewed by Geoffrey Garen.
497
498         No longer check ENABLE_LLINT_C_LOOP to determine the value of ENABLE_JIT.
499
500         * wtf/Platform.h:
501
502 2015-04-28  Alex Christensen  <achristensen@webkit.org>
503
504         Properly reset deleted count when clearing HashTables.
505         https://bugs.webkit.org/show_bug.cgi?id=144343
506
507         Reviewed by Andreas Kling.
508
509         * wtf/HashTable.h:
510         (WTF::KeyTraits>::clear):
511         Reset m_deletedCount, which appears to have been forgotten.
512
513 2015-04-28  Alex Christensen  <achristensen@webkit.org>
514
515         [Content Extensions] Use less memory for CombinedURLFilters.
516         https://bugs.webkit.org/show_bug.cgi?id=144290
517
518         Reviewed by Andreas Kling.
519
520         * wtf/Forward.h:
521         * wtf/Vector.h:
522         Added a minCapacity template parameter to allow changing the minimum size of an 
523         allocated buffer. The default minCapacity is kept at 16 unless otherwise specified 
524         to have no change on existing code, but this could be changed later. A smaller 
525         default minCapacity would use less memory with small Vectors but spend more time 
526         copying when expanding to large Vectors.
527
528 2015-04-27  Brent Fulgham  <bfulgham@apple.com>
529
530         [Win] Deactivate WebGL until Windows tests work properly
531         https://bugs.webkit.org/show_bug.cgi?id=144291
532         <rdar://problem/20707307>
533
534         Reviewed by Zalan Bujtas.
535
536         * wtf/FeatureDefines.h: Force WebGL off for Windows builds.
537
538 2015-04-27  Michael Catanzaro  <mcatanzaro@igalia.com>
539
540         Rename WTF_USE_3D_GRAPHICS to ENABLE_GRAPHICS_CONTEXT_3D
541         https://bugs.webkit.org/show_bug.cgi?id=144193
542
543         Reviewed by Darin Adler.
544
545         * wtf/FeatureDefines.h:
546         * wtf/Platform.h:
547
548 2015-04-22  Martin Robinson  <mrobinson@igalia.com>
549
550         [CMake] Autogenerate cmakeconfig.h.cmake
551         https://bugs.webkit.org/show_bug.cgi?id=143997
552
553         Reviewed by Csaba Osztrogonác.
554
555         * wtf/Platform.h: Move a GTK-specific setting from cmakeconfig.h to here.
556
557 2015-04-25  Martin Robinson  <mrobinson@igalia.com>
558
559         Rename ENABLE_3D_RENDERING to ENABLE_3D_TRANSFORMS
560         https://bugs.webkit.org/show_bug.cgi?id=144182
561
562         Reviewed by Simon Fraser.
563
564         * wtf/FeatureDefines.h: Replace all instances of 3D_RENDERING with 3D_TRANSFORMS.
565
566 2015-04-24  Commit Queue  <commit-queue@webkit.org>
567
568         Unreviewed, rolling out r183288.
569         https://bugs.webkit.org/show_bug.cgi?id=144189
570
571         Made js/sort-with-side-effecting-comparisons.html time out in
572         debug builds (Requested by ap on #webkit).
573
574         Reverted changeset:
575
576         "It shouldn't take 1846 lines of code and 5 FIXMEs to sort an
577         array."
578         https://bugs.webkit.org/show_bug.cgi?id=144013
579         http://trac.webkit.org/changeset/183288
580
581 2015-04-21  Geoffrey Garen  <ggaren@apple.com>
582
583         It shouldn't take 1846 lines of code and 5 FIXMEs to sort an array.
584         https://bugs.webkit.org/show_bug.cgi?id=144013
585
586         Reviewed by Mark Lam.
587
588         Remove this custom tree implementation because it is unused. (It was
589         previously used to achieve a stable array sort in certain cases.)
590
591         * WTF.vcxproj/WTF.vcxproj:
592         * WTF.vcxproj/WTF.vcxproj.filters:
593         * WTF.xcodeproj/project.pbxproj:
594         * wtf/AVLTree.h: Removed.
595         * wtf/CMakeLists.txt:
596
597 2015-04-24  Darin Adler  <darin@apple.com>
598
599         Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
600         https://bugs.webkit.org/show_bug.cgi?id=128007
601
602         Reviewed by Anders Carlsson.
603
604         * WTF.vcxproj/WTF.vcxproj: Removed OwnPtr source files.
605         * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
606         * WTF.xcodeproj/project.pbxproj: Ditto.
607         * wtf/CMakeLists.txt: Ditto.
608
609         * wtf/Forward.h: Removed OwnPtr and PassOwnPtr.
610         * wtf/HashTraits.h: Ditto.
611
612         * wtf/OwnPtr.h: Removed.
613         * wtf/OwnPtrCommon.h: Removed.
614         * wtf/PassOwnPtr.h: Removed.
615
616         * wtf/SizeLimits.cpp: Removed OwnPtr.
617         * wtf/VectorTraits.h: Removed OwnPtr specialization.
618
619 2015-04-23  Jer Noble  <jer.noble@apple.com>
620
621         Disable HAVE_AVKIT on AppleTV
622         https://bugs.webkit.org/show_bug.cgi?id=144142
623
624         Reviewed by Dan Bernstein.
625
626         * wtf/Platform.h:
627
628 2015-04-23  Alexey Proskuryakov  <ap@apple.com>
629
630         [iOS] WebKit services should inherit environment variables for home
631         https://bugs.webkit.org/show_bug.cgi?id=144078
632         rdar://problem/20571678
633
634         Reviewed by Dan Bernstein.
635
636         * wtf/spi/darwin/XPCSPI.h: Added xpc_copy_bootstrap and xpc_dictionary_apply.
637
638 2015-04-23  Alexey Proskuryakov  <ap@apple.com>
639
640         Undo the WTF part of the previous build fix, we don't use private headers in WTF.
641
642         * WTF.xcodeproj/project.pbxproj:
643
644 2015-04-23  Alexey Proskuryakov  <ap@apple.com>
645
646         Build fix.
647
648         * WTF.xcodeproj/project.pbxproj: Make RAMSize.h a private header, now that it's used
649         from outside WTF.
650
651 2015-04-23  Andreas Kling  <akling@apple.com>
652
653         There should only be one way to get the system memory size.
654         <https://webkit.org/b/144081>
655
656         Reviewed by Antti Koivisto.
657
658         Merge all the logic from other RAM size fetcher helpers into WTF's.
659
660         Darwin ports now use host_info() instead of sysctl(), since that was the more common way
661         of doing this.
662
663         Also bumped the fallback answer from 128 MB to 512 MB to bring it closer to today's hardware.
664
665         Finally, the number is rounded up to the next multiple of 128 MB, to avoid misunderstandings
666         on some systems where the number returned by the kernel is slightly lower than the marketing
667         number. Removed the "fudging" that was used in some places, since this fixes that cleanly.
668
669         * wtf/RAMSize.cpp:
670         (WTF::computeRAMSize):
671
672 2015-04-22  Darin Adler  <darin@apple.com>
673
674         Eliminate remaining uses of OwnPtr and PassOwnPtr in WebCore outside the editing and platform directories
675         https://bugs.webkit.org/show_bug.cgi?id=143949
676
677         Reviewed by Andreas Kling.
678
679         * wtf/MathExtras.h:
680         (wtf_ceil): Deleted. This was a workaround for a bug that was introduced in Leopard and
681         fixed in Snow Leopard <rdar://problem/6286405>, so we don't need the workaround any more.
682
683 2015-04-22  Alexey Proskuryakov  <ap@apple.com>
684
685         [Mac] In nightlies and local builds, WebKit services can get terminated under memory pressure
686         https://bugs.webkit.org/show_bug.cgi?id=144052
687         rdar://problem/19754404
688
689         Build fix. Landing a forward declaration that should have been part of the original patch.
690
691         * wtf/spi/darwin/XPCSPI.h:
692
693 2015-04-21  Chris Dumez  <cdumez@apple.com>
694
695         Make Vector(const Vector<T, otherCapacity, otherOverflowBehaviour>&) constructor explicit
696         https://bugs.webkit.org/show_bug.cgi?id=143970
697
698         Reviewed by Darin Adler.
699
700         Make Vector(const Vector<T, otherCapacity, otherOverflowBehaviour>&)
701         constructor explicit as it copies the vector and it is easy to call it
702         by mistake.
703
704         * wtf/RefCountedArray.h:
705         (WTF::RefCountedArray::RefCountedArray):
706         * wtf/Vector.h:
707
708 2015-04-21  Darin Adler  <darin@apple.com>
709
710         Remove some stray uses of OwnPtr and PassOwnPtr in WTF (outside of the template definitions and traits)
711         https://bugs.webkit.org/show_bug.cgi?id=143944
712
713         Reviewed by Andreas Kling.
714
715         * wtf/FilePrintStream.h: Removed unneeded include.
716         * wtf/HashTable.h: Fixed class template name in comment.
717         * wtf/HashTraits.h: Removed unneeded forward declaration.
718         * wtf/ListHashSet.h: Removed unneeded includes.
719         * wtf/ThreadingWin.cpp: Removed unneeded includes.
720         (WTF::wtfThreadEntryPoint): Changed code to use unique_ptr.
721         (WTF::createThreadInternal): Changed code to use make_unique and release.
722         * wtf/efl/RunLoopEfl.cpp: Removed unneeded includes.
723
724 2015-04-19  Darin Adler  <darin@apple.com>
725
726         Update RefPtr documentation and deprecation
727         https://bugs.webkit.org/show_bug.cgi?id=143936
728
729         Reviewed by Andreas Kling.
730
731         * WTF.vcxproj/WTF.vcxproj: Removed PassRef.h
732         * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
733         * WTF.xcodeproj/project.pbxproj: Ditto.
734         * wtf/CMakeLists.txt: Ditto.
735
736 2015-04-17  Alexey Proskuryakov  <ap@apple.com>
737
738         Use ASan poisoning to taint moved-out-of Refs
739         https://bugs.webkit.org/show_bug.cgi?id=143894
740         rdar://problem/19443723
741
742         Reviewed by Darin Adler.
743
744         * wtf/Ref.h: (WTF::Ref::~Ref):
745
746 2015-04-17  Alexey Proskuryakov  <ap@apple.com>
747
748         Remove unused BoundsCheckedPointer
749         https://bugs.webkit.org/show_bug.cgi?id=143896
750
751         Reviewed by Geoffrey Garen.
752
753         * WTF.vcxproj/WTF.vcxproj:
754         * WTF.vcxproj/WTF.vcxproj.filters:
755         * WTF.xcodeproj/project.pbxproj:
756         * wtf/BoundsCheckedPointer.h: Removed.
757         * wtf/CMakeLists.txt:
758
759 2015-04-16  Yusuke Suzuki  <utatane.tea@gmail.com>
760
761         [ES6] Implement Symbol.for and Symbol.keyFor
762         https://bugs.webkit.org/show_bug.cgi?id=143404
763
764         Reviewed by Geoffrey Garen.
765
766         When we register symbolized StringImpl* into SymbolRegistry, symbolized StringImpl* is aware of that.
767         And when destructing it, it removes its reference from SymbolRegistry as if atomic StringImpl do so with AtomicStringTable.
768         While AtomicStringTable (in WebCore case) exists in thread local storage,
769         SymbolRegistry exists per VM and StringImpl* has a reference to the registered SymbolRegistry.
770
771         Since StringImpl has isSymbol etc. members, it's class is aware of Symbol use cases.
772         So introduce SymbolRegistry in WTF layers as if AtomicStringTable.
773
774         * WTF.vcxproj/WTF.vcxproj:
775         * WTF.vcxproj/WTF.vcxproj.filters:
776         * WTF.xcodeproj/project.pbxproj:
777         * wtf/CMakeLists.txt:
778         * wtf/text/AtomicString.cpp:
779         (WTF::AtomicString::addSlowCase):
780         (WTF::AtomicString::findSlowCase):
781         (WTF::AtomicString::findInternal):
782         (WTF::AtomicString::find): Deleted.
783         * wtf/text/AtomicString.h:
784         (WTF::AtomicString::find):
785         * wtf/text/StringImpl.cpp:
786         (WTF::StringImpl::~StringImpl):
787         (WTF::StringImpl::createSymbol):
788         (WTF::StringImpl::createSymbolEmpty):
789         * wtf/text/StringImpl.h:
790         (WTF::StringImpl::StringImpl):
791         (WTF::StringImpl::extractFoldedStringInSymbol):
792         (WTF::StringImpl::symbolRegistry):
793         (WTF::StringImpl::createSymbolEmpty): Deleted.
794         * wtf/text/SymbolRegistry.cpp: Copied from Source/JavaScriptCore/runtime/SymbolConstructor.h.
795         (WTF::SymbolRegistry::~SymbolRegistry):
796         (WTF::SymbolRegistry::symbolForKey):
797         (WTF::SymbolRegistry::keyForSymbol):
798         (WTF::SymbolRegistry::remove):
799         * wtf/text/SymbolRegistry.h: Added.
800         (WTF::SymbolRegistryKey::hash):
801         (WTF::SymbolRegistryKey::impl):
802         (WTF::SymbolRegistryKey::isHashTableDeletedValue):
803         (WTF::SymbolRegistryKey::hashTableDeletedValue):
804         (WTF::DefaultHash<SymbolRegistryKey>::Hash::hash):
805         (WTF::DefaultHash<SymbolRegistryKey>::Hash::equal):
806         (WTF::HashTraits<SymbolRegistryKey>::isEmptyValue):
807         (WTF::SymbolRegistryKey::SymbolRegistryKey):
808
809 2015-04-16  Antti Koivisto  <antti@apple.com>
810
811         Use CommonCrypto for SHA1 and MD5
812         https://bugs.webkit.org/show_bug.cgi?id=143826
813
814         Reviewed by Anders Carlsson.
815
816         CommonCrypto SHA1 implementation is ~4x faster than the naive WTF one. Use it when available.
817
818         These are covered by existing API tests.
819
820         * wtf/MD5.cpp:
821         (WTF::MD5::MD5):
822         (WTF::MD5::addBytes):
823         (WTF::MD5::checksum):
824         * wtf/MD5.h:
825         * wtf/SHA1.cpp:
826         (WTF::SHA1::SHA1):
827         (WTF::SHA1::addBytes):
828         (WTF::SHA1::computeHash):
829
830             Remove the side effect where computeHash resets the state. No one relies on it.
831
832         (WTF::SHA1::hexDigest):
833         (WTF::SHA1::computeHexDigest):
834         * wtf/SHA1.h:
835
836 2015-04-16  Csaba Osztrogonác  <ossy@webkit.org>
837
838         Remove the unnecessary WTF_CHANGES define
839         https://bugs.webkit.org/show_bug.cgi?id=143825
840
841         Reviewed by Andreas Kling.
842
843         * config.h:
844
845 2015-04-15  Руслан Ижбулатов  <lrn1986@gmail.com>
846
847         Harmonize binary semaphore ifdefs
848
849         They should be either OS(WINDOWS) (in which case we'd need
850         BinarySemaphoreWin.cpp, which is not shipped by WebKitGTK)
851         or PLATFORM(WIN) (in which case Mutex/ThreadCondition-based
852         implementation is used).
853
854         This fixes errors like:
855           CXX      Source/WTF/wtf/threads/libWTF_la-BinarySemaphore.lo
856         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp: In constructor 'WTF::BinarySemaphore::BinarySemaphore()':
857         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:34:7: error: class 'WTF::BinarySemaphore' does not have any field named 'm_isSet'
858              : m_isSet(false)
859                ^
860         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp: In member function 'void WTF::BinarySemaphore::signal()':
861         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:44:24: error: 'm_mutex' was not declared in this scope
862              MutexLocker locker(m_mutex);
863                                 ^
864         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:46:5: error: 'm_isSet' was not declared in this scope
865              m_isSet = true;
866              ^
867         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:47:5: error: 'm_condition' was not declared in this scope
868              m_condition.signal();
869              ^
870         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp: In member function 'bool WTF::BinarySemaphore::wait(double)':
871         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:52:24: error: 'm_mutex' was not declared in this scope
872              MutexLocker locker(m_mutex);
873                                 ^
874         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:55:13: error: 'm_isSet' was not declared in this scope
875              while (!m_isSet) {
876                      ^
877         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:56:21: error: 'm_condition' was not declared in this scope
878                  timedOut = !m_condition.timedWait(m_mutex, absoluteTime);
879                              ^
880         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:62:5: error: 'm_isSet' was not declared in this scope
881              m_isSet = false;
882              ^
883         GNUmakefile:52762: recipe for target 'Source/WTF/wtf/threads/libWTF_la-BinarySemaphore.lo' failed
884
885         [W32] Inconsistent ifdefs in BinarySemaphore.h and BinarySemaphore.cpp
886         https://bugs.webkit.org/show_bug.cgi?id=143756
887
888         Reviewed by Darin Adler.
889
890         * wtf/threads/BinarySemaphore.h:
891
892 2015-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
893
894         Fix -Wparentheses warning with GCC 5 in SaturatedArithmetic.h
895         https://bugs.webkit.org/show_bug.cgi?id=143457
896
897         Reviewed by Benjamin Poulain.
898
899         Tested by WTF.SaturatedArithmeticAddition and WTF.SaturatedArithmeticSubtraction.
900
901         * wtf/SaturatedArithmetic.h:
902         (signedAddOverflows): Use && instead of & to avoid triggering -Wparentheses in newer
903         versions of GCC and Clang, and to improve the clarity of the function.
904         (signedSubtractOverflows): Changed correspondingly, although there was no warning here.
905
906 2015-04-08  Sam Weinig  <sam@webkit.org>
907
908         Allow LaunchServices to handle URLs on link navigations
909         <rdar://problem/19446826>
910         https://bugs.webkit.org/show_bug.cgi?id=143544
911
912         Reviewed by Anders Carlsson.
913
914         * wtf/Platform.h:
915         Add HAVE macro for this functionality.
916
917 2015-04-09  Andy Estes  <aestes@apple.com>
918
919         [Cocoa] Add a HAVE(AVKIT) and use it
920         https://bugs.webkit.org/show_bug.cgi?id=143593
921
922         Reviewed by David Kilzer.
923
924         * wtf/Platform.h: Defined HAVE(AVKIT) to be true on all Cocoa platforms except Watch OS.
925
926 2015-04-09  Andy Estes  <aestes@apple.com>
927
928         [Content Filtering] Add a HAVE(PARENTAL_CONTROLS) and use it
929         https://bugs.webkit.org/show_bug.cgi?id=143559
930
931         Reviewed by David Kilzer.
932
933         Added PLATFORM(WATCHOS). Used PLATFORM() since Watch OS is just a variant of OS(IOS).
934         Defined HAVE(PARENTAL_CONTROLS) to be true on all Cocoa platforms except Watch OS.
935
936         * wtf/Platform.h:
937
938 2015-04-08  Alex Christensen  <achristensen@webkit.org> and Patrick Gansterer  <paroga@webkit.org>
939
940         Add CMake build system for WinCairo port.
941         https://bugs.webkit.org/show_bug.cgi?id=115944
942
943         Reviewed by Chris Dumez.
944
945         * wtf/FeatureDefines.h:
946         * wtf/PlatformWin.cmake:
947
948 2015-04-05  Antti Koivisto  <antti@apple.com>
949
950         Bloom filter should support longer hashes
951         https://bugs.webkit.org/show_bug.cgi?id=143419
952
953         Reviewed by Dan Bernstein.
954
955         It currently supports 'unsigned' hash only which is inconvenient and doesn't have enough independent bits for larger filters.
956
957         Support arbitrarily sized hashes of type std::array<uint8_t, hashSize> (like SHA1::Digest and MD5::Digest).
958
959         * wtf/BloomFilter.h:
960         (WTF::BloomFilter<keyBits>::keysFromHash):
961         (WTF::BloomFilter<keyBits>::mayContain):
962         (WTF::BloomFilter<keyBits>::add):
963
964 2015-04-03  Antti Koivisto  <antti@apple.com>
965
966         Add non-counting Bloom filter implementation
967         https://bugs.webkit.org/show_bug.cgi?id=143366
968
969         Reviewed by Sam Weinig.
970
971         Add a traditional single-bit-per-bucket Bloom filter in addition to the existing counting implementation.
972
973         - rename BloomFilter -> CountingBloomFilter.
974         - add a new basic BloomFilter type.
975         - update some terminology to match http://en.wikipedia.org/wiki/Bloom_filter and modernize the code a bit.
976         - add API tests.
977
978         * wtf/BloomFilter.h:
979         (WTF::BloomFilter::BloomFilter):
980         (WTF::BloomFilter::add):
981
982             Also support merging.
983
984         (WTF::BloomFilter::mayContain):
985         (WTF::BloomFilter::arrayIndex):
986         (WTF::BloomFilter::bitMask):
987         (WTF::BloomFilter<keyBits>::mayContain):
988         (WTF::BloomFilter<keyBits>::add):
989         (WTF::BloomFilter<keyBits>::isBitSet):
990         (WTF::BloomFilter<keyBits>::setBit):
991         (WTF::BloomFilter<keyBits>::clear):
992         (WTF::CountingBloomFilter::CountingBloomFilter):
993         (WTF::CountingBloomFilter::mayContain):
994         (WTF::CountingBloomFilter::firstBucket):
995         (WTF::CountingBloomFilter::secondBucket):
996         (WTF::CountingBloomFilter<keyBits>::add):
997         (WTF::CountingBloomFilter<keyBits>::remove):
998         (WTF::CountingBloomFilter<keyBits>::clear):
999         (WTF::CountingBloomFilter<keyBits>::likelyEmpty):
1000         (WTF::CountingBloomFilter<keyBits>::isClear):
1001         (WTF::BloomFilter::maximumCount): Deleted.
1002         (WTF::BloomFilter::firstSlot): Deleted.
1003         (WTF::BloomFilter::secondSlot): Deleted.
1004         (WTF::BloomFilter<keyBits>::remove): Deleted.
1005         (WTF::BloomFilter<keyBits>::likelyEmpty): Deleted.
1006         (WTF::BloomFilter<keyBits>::isClear): Deleted.
1007
1008 015-04-01  Antti Koivisto  <antti@apple.com>
1009
1010         Value assignment operator of Optional should be stricter
1011         https://bugs.webkit.org/show_bug.cgi?id=143303
1012
1013         Reviewed by Andreas Kling.
1014
1015         struct Foo { mutable Optional<std::chrono::seconds> s; };
1016         Foo foo, foo2;
1017         foo = foo2;
1018
1019         doesn't build because it tries to use wrong operator=.
1020
1021         * wtf/Optional.h:
1022
1023             Add enable_if test similar to std::experimental::optional.
1024
1025 2015-04-01  Alex Christensen  <achristensen@webkit.org>
1026
1027         Progress towards CMake on Windows and Mac.
1028         https://bugs.webkit.org/show_bug.cgi?id=143293
1029
1030         Reviewed by Filip Pizlo.
1031
1032         * wtf/CMakeLists.txt:
1033         Don't use bmalloc on Windows yet.
1034         * wtf/FeatureDefines.h:
1035         Temporarily disabled WebGL on Windows CMake builds.
1036         * wtf/PlatformMac.cmake:
1037         Tell open source builders where to find unicode headers.
1038
1039 2015-03-31  Alexey Proskuryakov  <ap@apple.com>
1040
1041         Fix the build after <http://trac.webkit.org/changeset/182205>.
1042
1043         * wtf/text/StringImpl.h: (WTF::StringImpl::extractFoldedStringInSymbol):
1044         A function cannot be both exported and inline.
1045
1046 2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
1047
1048         Clean up Identifier factories to clarify the meaning of StringImpl*
1049         https://bugs.webkit.org/show_bug.cgi?id=143146
1050
1051         Reviewed by Filip Pizlo.
1052
1053         Introduce StringKind into `StringImpl`. There's 3 kinds
1054         1. StringNormal (non-atomic, non-symbol)
1055         2. StringAtomic (atomic, non-symbol)
1056         3. StringSymbol (non-atomic, symbol)
1057         They are mutually exclusive.
1058
1059         * wtf/text/AtomicString.cpp:
1060         (WTF::AtomicString::addSlowCase):
1061         (WTF::AtomicString::findSlowCase):
1062         When registering a string into AtomicStringTable,
1063         it should not be a symbol string
1064         because symbol and atomic types are mutually exclusive.
1065         When a symbol string comes, we extract an owner string
1066         from a symbol string by using `StringImpl::extractFoldedStringInSymbol()`.
1067         It always succeeds because a symbol (non empty) string
1068         is always BufferSubstring and has an owner string.
1069         Empty symbol string doesn't have an owner string.
1070         This case is filtered by `!string.length()` guard.
1071         * wtf/text/AtomicString.h:
1072         (WTF::AtomicString::add):
1073         (WTF::AtomicString::addWithStringTableProvider):
1074         * wtf/text/StringImpl.cpp:
1075         (WTF::StringImpl::~StringImpl):
1076         (WTF::StringImpl::createSymbol):
1077         (WTF::StringImpl::createUnique): Deleted.
1078         * wtf/text/StringImpl.h:
1079         (WTF::StringImpl::StringImpl):
1080         (WTF::StringImpl::createSymbolEmpty):
1081         (WTF::StringImpl::flagIsAtomic):
1082         (WTF::StringImpl::flagIsSymbol):
1083         (WTF::StringImpl::maskStringKind):
1084         (WTF::StringImpl::stringKind):
1085         (WTF::StringImpl::isSymbol):
1086         (WTF::StringImpl::isAtomic):
1087         (WTF::StringImpl::setIsAtomic):
1088         (WTF::StringImpl::extractFoldedStringInSymbol):
1089         (WTF::StringImpl::createUniqueEmpty): Deleted.
1090         (WTF::StringImpl::flagIsUnique): Deleted.
1091         (WTF::StringImpl::isUnique): Deleted.
1092         * wtf/text/StringStatics.cpp:
1093         (WTF::StringImpl::hashAndFlagsForSymbol):
1094         (WTF::StringImpl::hashAndFlagsForUnique): Deleted.
1095
1096 2015-03-30  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
1097
1098         [CMake][EFL] Remove redundant library link and include path
1099         https://bugs.webkit.org/show_bug.cgi?id=143221
1100
1101         Reviewed by Csaba Osztrogonác.
1102
1103         * wtf/PlatformEfl.cmake: Remove unnecessary library link and include path.
1104
1105 2015-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
1106
1107         Support building WTF on Windows without Cygwin
1108         https://bugs.webkit.org/show_bug.cgi?id=143084
1109
1110         Reviewed by Brent Fulgham.
1111
1112         Windows doesn't have "touch".
1113
1114         * WTF.vcxproj/WTFGenerated.make:
1115
1116 2015-03-26  Alex Christensen  <achristensen@webkit.org>
1117
1118         Progress towards CMake on Mac.
1119         https://bugs.webkit.org/show_bug.cgi?id=143112
1120
1121         Reviewed by Chris Dumez.
1122
1123         * wtf/PlatformMac.cmake:
1124
1125 2015-03-25  Filip Pizlo  <fpizlo@apple.com>
1126
1127         Unreviewed, we have edited this file in 2015.
1128
1129         * wtf/Platform.h:
1130
1131 2015-03-25  Filip Pizlo  <fpizlo@apple.com>
1132
1133         Heap variables shouldn't end up in the stack frame
1134         https://bugs.webkit.org/show_bug.cgi?id=141174
1135
1136         Reviewed by Geoffrey Garen.
1137
1138         * wtf/FastBitVector.h:
1139         (WTF::FastBitVector::resize): Small change: don't resize if you don't have to resize.
1140
1141 2015-03-25  Filip Pizlo  <fpizlo@apple.com>
1142
1143         Change Atomic methods from using the_wrong_naming_conventions to using theRightNamingConventions. Also make seq_cst the default.
1144
1145         Rubber stamped by Geoffrey Garen.
1146
1147         * wtf/Atomics.h:
1148         (WTF::Atomic::load):
1149         (WTF::Atomic::store):
1150         (WTF::Atomic::compareExchangeWeak):
1151         (WTF::Atomic::compareExchangeStrong):
1152         (WTF::Atomic::compare_exchange_weak): Deleted.
1153         (WTF::Atomic::compare_exchange_strong): Deleted.
1154         * wtf/ByteSpinLock.h:
1155         (WTF::ByteSpinLock::lock):
1156         * wtf/SpinLock.h:
1157         (WTF::SpinLockBase::lock):
1158
1159 2015-03-24  Beth Dakin  <bdakin@apple.com>
1160
1161         Add events related to force click gesture
1162         https://bugs.webkit.org/show_bug.cgi?id=142836
1163         -and corresponding-
1164         rdar://problem/20210239
1165
1166         Reviewed by Dean Jackson.
1167
1168         New enable flag for the events.
1169         * wtf/FeatureDefines.h:
1170
1171 2015-03-23  Filip Pizlo  <fpizlo@apple.com>
1172
1173         JSC should have a low-cost asynchronous disassembler
1174         https://bugs.webkit.org/show_bug.cgi?id=142997
1175
1176         Reviewed by Mark Lam.
1177
1178         * wtf/StringPrintStream.h:
1179
1180 2015-03-22  Benjamin Poulain  <benjamin@webkit.org>
1181
1182         CSS Selectors: fix attribute case-insensitive matching of Contain and List
1183         https://bugs.webkit.org/show_bug.cgi?id=142932
1184
1185         Reviewed by Darin Adler.
1186
1187         Add some utility functions to the string classes to find substrings
1188         using ASCII case-insensitive comparisons.
1189
1190         * wtf/text/AtomicString.h:
1191         (WTF::AtomicString::contains):
1192         Add the light version that only lock one register.
1193
1194         (WTF::AtomicString::containsIgnoringASCIICase):
1195         (WTF::AtomicString::findIgnoringASCIICase):
1196
1197         * wtf/text/StringCommon.h:
1198         (WTF::findIgnoringASCIICase):
1199         This is the common implementation used by StringView and StringImpl.
1200
1201         * wtf/text/StringImpl.cpp:
1202         (WTF::StringImpl::findIgnoringASCIICase):
1203         * wtf/text/StringImpl.h:
1204         * wtf/text/StringView.cpp:
1205         (WTF::StringView::containsIgnoringASCIICase):
1206         (WTF::StringView::findIgnoringASCIICase):
1207         * wtf/text/StringView.h:
1208         * wtf/text/WTFString.h:
1209         (WTF::String::findIgnoringASCIICase):
1210         (WTF::String::contains):
1211         (WTF::String::containsIgnoringASCIICase):
1212
1213 2015-03-19  Andreas Kling  <akling@apple.com>
1214
1215         DFGAllocator should use bmalloc's aligned allocator.
1216         <https://webkit.org/b/142871>
1217
1218         Reviewed by Geoffrey Garen.
1219
1220         Remove PageAllocationAligned since it has no more clients.
1221
1222         * WTF.vcxproj/WTF.vcxproj:
1223         * WTF.vcxproj/WTF.vcxproj.filters:
1224         * WTF.xcodeproj/project.pbxproj:
1225         * wtf/CMakeLists.txt:
1226         * wtf/PageAllocationAligned.cpp: Removed.
1227         * wtf/PageAllocationAligned.h: Removed.
1228
1229 2015-03-18  Dhi Aurrahman  <diorahman@rockybars.com>
1230
1231         Fix StringView misplaced implementations after r181525 and r181558
1232         https://bugs.webkit.org/show_bug.cgi?id=142772
1233
1234         Reviewed by Darin Adler.
1235
1236         Fix misplaced implementations in StringView::startsWithIgnoringASCIICase and 
1237         StringView::endsWith. 
1238
1239         Add some tests in [1] to cover the StringView::startsWith, 
1240         StringView::startsWithIgnoringASCIICase, StringView::endsWith and 
1241         StringView::endsWithIgnoringASCIICase implementations.
1242
1243         [1] Tools/TestWebKitAPI/Tests/WTF/StringView.cpp.
1244
1245         * wtf/text/StringView.cpp:
1246         (WTF::StringView::startsWithIgnoringASCIICase):
1247         (WTF::StringView::endsWith):
1248         (WTF::StringView::endsWithIgnoringASCIICase):
1249
1250 2015-03-17  Michael Saboff  <msaboff@apple.com>
1251
1252         Windows X86-64 should use the fixed executable allocator
1253         https://bugs.webkit.org/show_bug.cgi?id=142749
1254
1255         Reviewed by Filip Pizlo.
1256
1257         Set ENABLE_EXECUTABLE_ALLOCATOR_FIXED for Windows.
1258         Needed to export MetaAllocator::currentStatistics() for use in JavaScriptCore.
1259
1260         * wtf/MetaAllocator.h:
1261         * wtf/Platform.h:
1262
1263 2015-03-16  Ryosuke Niwa  <rniwa@webkit.org>
1264
1265         Enable ES6 classes by default
1266         https://bugs.webkit.org/show_bug.cgi?id=142774
1267
1268         Reviewed by Gavin Barraclough.
1269
1270         * wtf/FeatureDefines.h:
1271
1272 2015-03-16  Csaba Osztrogonác  <ossy@webkit.org>
1273
1274         [ARM] Enable generating idiv instructions if it is supported
1275         https://bugs.webkit.org/show_bug.cgi?id=142725
1276
1277         Reviewed by Michael Saboff.
1278
1279         * wtf/Platform.h: Set HAVE_ARM_IDIV_INSTRUCTIONS based on GCC macro too.
1280
1281 2015-03-16  Benjamin Poulain  <benjamin@webkit.org>
1282
1283         Fix StringView after r181525
1284         Unreviewed.
1285
1286         Fix 2 silly mistakes I made in r181525.
1287
1288         * wtf/text/StringView.cpp:
1289         (WTF::StringView::startsWith):
1290         (WTF::StringView::startsWithIgnoringASCIICase):
1291         (WTF::StringView::endsWith):
1292         (WTF::StringView::endsWithIgnoringASCIICase):
1293         The implementation was inside the #ifdef.
1294
1295         * wtf/text/StringView.h:
1296         The symbols were not exported.
1297
1298 2015-03-16  Max Stepin  <maxstepin@gmail.com>
1299
1300         Add APNG support
1301         https://bugs.webkit.org/show_bug.cgi?id=17022
1302
1303         Reviewed by Carlos Garcia Campos.
1304
1305         * wtf/FeatureDefines.h:
1306
1307 2015-03-15  Benjamin Poulain  <benjamin@webkit.org>
1308
1309         CSS: fix the case-insensitive matching of the attribute selectors Begin, End and Hyphen
1310         https://bugs.webkit.org/show_bug.cgi?id=142715
1311
1312         Reviewed by Brent Fulgham.
1313
1314         Add the necessary infrastructure to test startsWith() and endsWith() with
1315         ASCII case-insentive comparisons.
1316
1317         * wtf/text/AtomicString.h:
1318         (WTF::AtomicString::startsWith):
1319         (WTF::AtomicString::startsWithIgnoringASCIICase):
1320         (WTF::AtomicString::endsWith):
1321         (WTF::AtomicString::endsWithIgnoringASCIICase):
1322
1323         * wtf/text/StringCommon.h:
1324         (WTF::loadUnaligned):
1325         (WTF::equal):
1326         I moved the low level equal() code from StringImpl to StringCommon
1327         since it is used by both StringImpl and StringView.
1328
1329         (WTF::equalCommon):
1330         (WTF::equalIgnoringASCIICaseCommon):
1331         Ideally we should drop the "Common" part of the name but StringView
1332         wants this inline for some reason. I prefered keeping the current behavior
1333         since I don't know how StringView's matching performance was evaluated.
1334
1335         (WTF::startsWith):
1336         (WTF::startsWithIgnoringASCIICase):
1337         (WTF::endsWith):
1338         (WTF::endsWithIgnoringASCIICase):
1339         Make all that code shared between StringView and Stringimpl.
1340
1341         * wtf/text/StringImpl.cpp:
1342         (WTF::StringImpl::startsWith):
1343         (WTF::StringImpl::startsWithIgnoringASCIICase):
1344         (WTF::StringImpl::endsWith):
1345         (WTF::StringImpl::endsWithIgnoringASCIICase):
1346         (WTF::equal):
1347         (WTF::stringImplContentEqual): Deleted.
1348         * wtf/text/StringImpl.h:
1349         (WTF::loadUnaligned): Deleted.
1350         (WTF::equal): Deleted.
1351
1352         * wtf/text/StringView.cpp:
1353         (WTF::StringView::startsWith):
1354         (WTF::StringView::startsWithIgnoringASCIICase):
1355         (WTF::StringView::endsWith):
1356         (WTF::StringView::endsWithIgnoringASCIICase):
1357         * wtf/text/StringView.h:
1358         Since those are new, we can safely make them out-of-line and
1359         evaluate the inlining impact as needed.
1360
1361         * wtf/text/WTFString.h:
1362         (WTF::String::startsWithIgnoringASCIICase):
1363         (WTF::String::endsWith):
1364         (WTF::String::endsWithIgnoringASCIICase):
1365
1366 2015-03-15  Benjamin Poulain  <bpoulain@apple.com>
1367
1368         Change the exact attribute matching to be ASCII case-insensitive
1369         https://bugs.webkit.org/show_bug.cgi?id=142609
1370
1371         Reviewed by Darin Adler.
1372
1373         Add support for ASCII case insensitive comparisons to all the string
1374         classes.
1375
1376         The new file StringCommon.h has the common algorithm to avoid repeating
1377         the same code with different types.
1378
1379         * WTF.vcxproj/WTF.vcxproj:
1380         * WTF.vcxproj/WTF.vcxproj.filters:
1381         * wtf/ASCIICType.h:
1382         (WTF::toASCIILower):
1383         * wtf/CMakeLists.txt:
1384         * wtf/text/AtomicString.h:
1385         (WTF::equalIgnoringASCIICase):
1386         * wtf/text/StringCommon.h: Added.
1387         (WTF::equalIgnoringASCIICase):
1388         (WTF::equalIgnoringASCIICaseCommon):
1389         * wtf/text/StringImpl.cpp:
1390         (WTF::equalIgnoringASCIICase):
1391         (WTF::equalIgnoringASCIICaseNonNull):
1392         (WTF::StringImpl::utf8Impl):
1393         (WTF::StringImpl::defaultWritingDirection): Deleted.
1394         (WTF::StringImpl::adopt): Deleted.
1395         (WTF::StringImpl::sizeInBytes): Deleted.
1396         (WTF::putUTF8Triple): Deleted.
1397         (WTF::StringImpl::utf8): Deleted.
1398         * wtf/text/StringImpl.h:
1399         (WTF::StringImpl::isSubString): Deleted.
1400         (WTF::find): Deleted.
1401
1402 2015-03-14  Michael Saboff  <msaboff@apple.com>
1403
1404         Disable Yarr JIT for ARMv7k
1405         https://bugs.webkit.org/show_bug.cgi?id=142645
1406
1407         Rubber stamped by Geoffrey Garen.
1408
1409         Changed the setting of ENABLE_YARR_JIT to be predicated on ENABLED_JIT.
1410
1411         * wtf/Platform.h:
1412
1413 2015-03-14  Michael Saboff  <msaboff@apple.com>
1414
1415         ES6: Add binary and octal literal support
1416         https://bugs.webkit.org/show_bug.cgi?id=142681
1417
1418         Reviewed by Ryosuke Niwa.
1419
1420         * wtf/ASCIICType.h:
1421         (WTF::isASCIIBinaryDigit): New support function.
1422         (WTF::isASCIIOctalDigit): Updated to use logical and (&&) instead of binary and (&).
1423
1424 2015-03-13  Mark Lam  <mark.lam@apple.com>
1425
1426         Replace TCSpinLock with a new WTF::SpinLock based on WTF::Atomic.
1427         <https://webkit.org/b/142674>
1428
1429         Reviewed by Filip Pizlo.
1430
1431         We no longer use TCMalloc in our code, and we now have C++11.  This replaces the
1432         TCMalloc_SpinLock with a new WTF::SpinLock based on WTF::Atomic (which is a
1433         wrapper around std::atomic).
1434
1435         Note that there is a StaticSpinLock and a SpinLock:
1436
1437         1. StaticSpinLock is an alias for SpinLockBase, and its initialization relies on
1438            static / global std:atomic being automatically initialized to 0 at compile time.
1439            Hence, StaticSpinLock should only be used for statics / globals (including
1440            static members of classes / structs).
1441
1442         2. SpinLock is derived from SpinLockBase, and adds a default constructor to
1443            initialize its internal atomic value to 0.  Because SpinLock has a constructor,
1444            it cannot be used for statics / globals.  Objects that want to embed a spin
1445            lock as an instance field should use SpinLock so that it is initialized properly.
1446            std::atomic will not automatically initialize instance fields to 0.  Hence,
1447            StaticSpinLock will not work correctly as instance fields of a class / struct.
1448
1449         * WTF.vcxproj/WTF.vcxproj:
1450         * WTF.vcxproj/WTF.vcxproj.filters:
1451         * WTF.xcodeproj/project.pbxproj:
1452         * wtf/CMakeLists.txt:
1453         * wtf/MetaAllocator.cpp:
1454         (WTF::MetaAllocator::~MetaAllocator):
1455         (WTF::MetaAllocator::MetaAllocator):
1456         * wtf/MetaAllocator.h:
1457         * wtf/SpinLock.h: Added.
1458         (WTF::SpinLockBase::lock):
1459         (WTF::SpinLockBase::unlock):
1460         (WTF::SpinLockBase::isLocked):
1461         (WTF::SpinLockBase::slowLock):
1462         (WTF::SpinLock::SpinLock):
1463         * wtf/TCSpinLock.h: Removed.
1464         * wtf/text/AtomicString.cpp:
1465
1466 2015-03-13  Mark Lam  <mark.lam@apple.com>
1467
1468         Introduce WTF::Atomic to wrap std::atomic for a friendlier CAS.
1469         <https://webkit.org/b/142661>
1470
1471         Reviewed by Filip Pizlo.
1472
1473         The CAS functions provided by std::atomic takes a reference to the expected
1474         value and modifies it if the CAS fails.  However, in a lot of our CAS usage,
1475         we don't want the expected value to change.  The solution to this is to
1476         provide a WTF::Atomic struct that wraps std::atomic, and provide CAS
1477         methods that won't alter the expected value if the CAS fails.
1478
1479         The method names in WTF::Atomic are chosen to be identical to those
1480         in std::atomic so that WTF::Atomic can be a simple drop in replacement
1481         for std::atomic.
1482
1483         Also changed ByteSpinLock to use WTF::Atomic instead of std::atomic.
1484
1485         * wtf/Atomics.h:
1486         (WTF::Atomic::load):
1487         (WTF::Atomic::store):
1488         (WTF::Atomic::compare_exchange_weak):
1489         (WTF::Atomic::compare_exchange_strong):
1490         * wtf/ByteSpinLock.h:
1491         (WTF::ByteSpinLock::ByteSpinLock):
1492         (WTF::ByteSpinLock::lock):
1493
1494 2015-03-12  Filip Pizlo  <fpizlo@apple.com>
1495
1496         Bytecode liveness analysis should have more lambdas and fewer sets
1497         https://bugs.webkit.org/show_bug.cgi?id=142647
1498
1499         Reviewed by Mark Lam.
1500         
1501         Add a method for iterating each set bit in a FastBitVector. Uses a functor as a callback since
1502         this allows for a more efficient algorithm.
1503
1504         * wtf/FastBitVector.h:
1505         (WTF::FastBitVector::forEachSetBit):
1506
1507 2015-03-12  Michael Saboff  <msaboff@apple.com>
1508
1509         Disable Yarr JIT for ARMv7k
1510         https://bugs.webkit.org/show_bug.cgi?id=142645
1511
1512         Reviewed by Oliver Hunt.
1513
1514         Make the setting of ENABLE_YARR_JIT match ENABLE_JIT for ARMv7k.
1515
1516         * wtf/Platform.h:
1517
1518 2015-03-12  Mark Lam  <mark.lam@apple.com>
1519
1520         Change WTF::ByteSpinLock to use std::atomic.
1521         <https://webkit.org/b/142644>
1522
1523         Reviewed by Filip Pizlo.
1524
1525         * wtf/ByteSpinLock.h:
1526         (WTF::ByteSpinLock::ByteSpinLock):
1527         (WTF::ByteSpinLock::lock):
1528         (WTF::ByteSpinLock::unlock):
1529         (WTF::ByteSpinLock::isHeld):
1530
1531 2015-03-12  Csaba Osztrogonác  <ossy@webkit.org>
1532
1533         [ARM][Linux] GC sometimes stuck in an infinite loop if parallel GC is enabled
1534         https://bugs.webkit.org/show_bug.cgi?id=141290
1535
1536         Reviewed by Carlos Garcia Campos.
1537
1538         * wtf/Platform.h: Enable parallel GC after r181319.
1539
1540 2015-03-11  Myles C. Maxfield  <mmaxfield@apple.com>
1541
1542         Use out-of-band messaging for RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline()
1543         https://bugs.webkit.org/show_bug.cgi?id=142569
1544
1545         Reviewed by David Hyatt.
1546
1547         Provide a callback to Optional::valueOrCompute() which is evaluated only if necessary.
1548
1549         * wtf/Optional.h:
1550         (WTF::Optional::valueOrCompute):
1551
1552 2015-03-10  Brent Fulgham  <bfulgham@apple.com>
1553
1554         [Win] 17 different JSC tests started to fail in DST
1555         https://bugs.webkit.org/show_bug.cgi?id=142531
1556
1557         Reviewed by Chris Dumez.
1558
1559         The stock 'GetTimeZoneInformation' call does not always match the actual Daylight
1560         Savings calendar. This results in a period of time when these tests fail.
1561
1562         If available, we should take advantage of the new 'GetTimeZoneInformationForYear',
1563         which accesses a dynamic calendar of DST dates, which is presumbably updated by
1564         Microsoft from year-to-year.
1565
1566         * wtf/DateMath.cpp:
1567         (WTF::timeZoneInformationForYearFunction): New function to conditionally access
1568         some Vista (and newer) functionality.
1569         (WTF::calculateUTCOffset): Call new function (if available) to calculate proper UTC
1570         time offset.
1571
1572 2015-03-10  Alex Christensen  <achristensen@webkit.org>
1573
1574         Use unsigned for HashSet size.
1575         https://bugs.webkit.org/show_bug.cgi?id=142518
1576
1577         Reviewed by Benjamin Poulain.
1578
1579         * wtf/HashCountedSet.h:
1580         (WTF::Traits>::size):
1581         (WTF::Traits>::capacity):
1582         * wtf/HashMap.h:
1583         (WTF::X>::size):
1584         (WTF::X>::capacity):
1585         * wtf/HashSet.h:
1586         (WTF::V>::size):
1587         (WTF::V>::capacity):
1588         * wtf/HashTable.h:
1589         (WTF::HashTable::Stats::recordCollisionAtCount):
1590         (WTF::HashTable::Stats::dumpStats):
1591         (WTF::HashTable::size):
1592         (WTF::HashTable::capacity):
1593         (WTF::KeyTraits>::deallocateTable):
1594         (WTF::KeyTraits>::checkTableConsistencyExceptSize):
1595         * wtf/HashTraits.h:
1596         * wtf/ListHashSet.h:
1597         (WTF::U>::size):
1598         (WTF::U>::capacity):
1599
1600 2015-03-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
1601
1602         Remove PassRefPtr from svg/properties classes.
1603         https://bugs.webkit.org/show_bug.cgi?id=142063.
1604
1605         Reviewed by Darin Adler.
1606
1607         * wtf/Ref.h:
1608         (WTF::static_reference_cast): Add a stat_cast function to Ref<>.
1609
1610 2015-03-10  Mark Lam  <mark.lam@apple.com>
1611
1612         [Win] JSC Build Warnings Need to be Resolved.
1613         <https://webkit.org/b/142366>
1614
1615         Reviewed by Brent Fulgham.
1616
1617         * wtf/Compiler.h:
1618         - MSVC also does not have the CONSIDERS_UNREACHABLE_CODE quirk.
1619
1620 2015-03-10  Geoffrey Garen  <ggaren@apple.com>
1621
1622         bmalloc: tryFastMalloc shouldn't crash
1623         https://bugs.webkit.org/show_bug.cgi?id=142443
1624
1625         Reviewed by Sam Weinig.
1626
1627         Rolling back in r181307 with a check for whether bmalloc is enabled, to
1628         avoid crashes when running with ASan and GuardMalloc.
1629
1630         * wtf/FastMalloc.cpp:
1631         (WTF::fastMalloc):
1632         (WTF::fastRealloc):
1633         (WTF::fastAlignedMalloc):
1634         (WTF::tryFastMalloc):
1635         (WTF::tryFastRealloc): Deleted.
1636         * wtf/FastMalloc.h:
1637
1638 2015-03-10  Michael Catanzaro  <mcatanzaro@igalia.com>
1639
1640         GCC: CRASH() should be annotated with NORETURN
1641         https://bugs.webkit.org/show_bug.cgi?id=142524
1642
1643         Reviewed by Anders Carlsson.
1644
1645         Add COMPILER(GCC) to #ifdefs that already exist for Clang.
1646
1647         * wtf/Assertions.cpp:
1648         * wtf/Assertions.h:
1649
1650 2015-03-09  Commit Queue  <commit-queue@webkit.org>
1651
1652         Unreviewed, rolling out r181307.
1653         https://bugs.webkit.org/show_bug.cgi?id=142525
1654
1655         Broke ASan tests (Requested by ap on #webkit).
1656
1657         Reverted changeset:
1658
1659         "bmalloc: tryFastMalloc shouldn't crash"
1660         https://bugs.webkit.org/show_bug.cgi?id=142443
1661         http://trac.webkit.org/changeset/181307
1662
1663 2015-03-09  Geoffrey Garen  <ggaren@apple.com>
1664
1665         bmalloc: tryFastMalloc shouldn't crash
1666         https://bugs.webkit.org/show_bug.cgi?id=142443
1667
1668         Reviewed by Darin Adler.
1669
1670         * wtf/FastMalloc.cpp:
1671         (WTF::fastMalloc):
1672         (WTF::fastRealloc):
1673         (WTF::fastAlignedMalloc): Don't check for null. bmalloc automatically
1674         crashes on allocation failure, and we'd rather not pay for an extra check.
1675
1676         (WTF::tryFastMalloc): Added an opt-out API to return null rather than
1677         crashing, since some clients need this.
1678
1679         (WTF::tryFastRealloc): Deleted. Unused.
1680
1681         * wtf/FastMalloc.h:
1682
1683 2015-03-09  Mark Lam  <mark.lam@apple.com>
1684
1685         8-bit version of weakCompareAndSwap() can cause an infinite loop.
1686         https://webkit.org/b/142513>
1687
1688         Reviewed by Filip Pizlo.
1689
1690         Presently, Bitmap::concurrentTestAndSet() uses the 8-bit version of
1691         weakCompareAndSwap() (which compares and swaps an uint8_t value).
1692         Bitmap::concurrentTestAndSet() has a loop that checks if a bit in the
1693         byte of interest has been set.  If not, it will call the 8-bit CAS
1694         function to set the bit.
1695
1696         Under the covers, for ARM, the 8-bit CAS function actually works with a
1697         32-bit CAS.  The 8-bit CAS will first fetch the 32-bit value in memory
1698         that should contain the 8-bit value, and check if it contains the
1699         expected byte.  If the value in memory doesn't have the expected byte,
1700         it will return early to its caller.  The expectation is that the caller
1701         will reload the byte from memory and call the 8-bit CAS again.
1702
1703         Unfortunately, this code path that returns early does not have a
1704         compiler fence.  Without a compiler fence, the C++ compiler can
1705         optimize away the reloading of the expected byte value, leaving it
1706         unchanged.  As a result, we'll have a infinite loop here that checks a
1707         value that will never change, and the loop will not terminate until the
1708         value changes.
1709
1710         The fix is to eliminate the early return check in the 8-bit CAS, and
1711         have it always call down to the 32-bit CAS.  The 32-bit CAS has a
1712         compiler fence which will prevent this issue.
1713
1714         * wtf/Atomics.h:
1715         (WTF::weakCompareAndSwap):
1716
1717 2015-03-09  Martin Robinson  <mrobinson@igalia.com>
1718
1719         [EFL] Move DispatchQueue to WTF
1720         https://bugs.webkit.org/show_bug.cgi?id=142493
1721
1722         Reviewed by Csaba Osztrogonác.
1723
1724         * wtf/PlatformEfl.cmake: Add DispatchQueue to the source list.
1725         * wtf/efl/DispatchQueueEfl.cpp: Renamed from Source/WebKit2/Platform/efl/DispatchQueueEfl.cpp.
1726         * wtf/efl/DispatchQueueEfl.h: Renamed from Source/WebKit2/Platform/efl/DispatchQueueEfl.h.
1727         * wtf/efl/DispatchQueueWorkItemEfl.h: Renamed from Source/WebKit2/Platform/efl/DispatchQueueWorkItemEfl.h.
1728
1729 2015-03-08  Brent Fulgham  <bfulgham@apple.com>
1730
1731         [Win] WTF::WorkQueue does not balance ref/deref properly
1732         https://bugs.webkit.org/show_bug.cgi?id=142471
1733
1734         Reviewed by Antti Koivisto.
1735
1736         Make sure we deref the count when we execute a function in the
1737         WorkQueue.
1738
1739         * wtf/win/WorkQueueWin.cpp:
1740         (WTF::WorkQueue::performWorkOnRegisteredWorkThread):
1741
1742 2015-03-07  Brent Fulgham  <bfulgham@apple.com>
1743
1744         [Win] Revive WTF::WorkQueue on Windows
1745         https://bugs.webkit.org/show_bug.cgi?id=142432
1746
1747         Reviewed by Darin Adler.
1748
1749         Revive the Windows implementation of WTF::WorkQueue.
1750
1751         * WTF.vcxproj/WTF.vcxproj:
1752         * WTF.vcxproj/WTF.vcxproj.filters:
1753         * wtf/WorkQueue.h:
1754         * wtf/win/WorkItemWin.cpp: Added.
1755         * wtf/win/WorkItemWin.h: Added.
1756         * wtf/win/WorkQueueWin.cpp: Added.
1757
1758 2015-03-06  Geoffrey Garen  <ggaren@apple.com>
1759
1760         Fix crashes seen on the the Windows buildbots after my last patch.
1761
1762         Unreviewed.
1763
1764         * wtf/FastMalloc.cpp:
1765         (WTF::fastAlignedMalloc): Let's pass these arguments in the right order.
1766
1767 2015-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
1768
1769         Crash in -[WebCascadeList objectAtIndex:] + 195
1770         https://bugs.webkit.org/show_bug.cgi?id=141274
1771
1772         Reviewed by David Kilzer.
1773
1774         * wtf/WeakPtr.h:
1775         (WTF::WeakPtrFactory::createWeakPtr): WebCascadeList uses a const FontCascade,
1776         and it calls createWeakPtr() on it. Therefore, createWeakPtr has to be marked
1777         const.
1778         (WTF::WeakPtrFactory::operator=): Removed because it was broken and had no
1779         callers
1780
1781 2015-03-06  Simon Fraser  <simon.fraser@apple.com>
1782
1783         Allow tree dumping functions to be used in release builds by switching a flag
1784         https://bugs.webkit.org/show_bug.cgi?id=142379
1785
1786         Reviewed by Zalan Bujtas.
1787
1788         There are various tree dumping functions that are useful for debugging, and sometimes
1789         you want to be able to use them in release builds. Currently they are surrounded by
1790         #ifndef NDEBUG. Change this to #if ENABLE(TREE_DEBUGGING), which is defined to 0 or 1
1791         in wtf/Platform.h
1792
1793         * wtf/Platform.h:
1794
1795 2015-03-05  Chris Dumez  <cdumez@apple.com>
1796
1797         Regression(r173761): ASSERTION FAILED: !is8Bit() in StringImpl::characters16()
1798         https://bugs.webkit.org/show_bug.cgi?id=142350
1799
1800         Reviewed by Michael Saboff and Benjamin Poulain.
1801
1802         Fix ASSERTION FAILED: !is8Bit() in StringImpl::characters16() from
1803         WTF::equalInner() after r173761. The code was incorrectly assuming that
1804         if stringImpl is 16-bit, then matchString is 16-bit too, which is not
1805         correct.
1806
1807         Also rename WTFString::startsWith() / endsWith() taking an offset to
1808         hasInfixStartingAt() / hasInfixEndingAt() for clarity. It seems odd
1809         to call it startsWith even though it won't technically *start* with
1810         the pattern if the input offset is greater than zero.
1811
1812         Also drop the caseSensitive argument as it is never used (always true
1813         at call sites.
1814
1815         * wtf/text/StringImpl.cpp:
1816         (WTF::equalInner):
1817         (WTF::StringImpl::hasInfixStartingAt):
1818         (WTF::StringImpl::hasInfixEndingAt):
1819         (WTF::StringImpl::startsWith): Deleted.
1820         (WTF::StringImpl::endsWith): Deleted.
1821         * wtf/text/StringImpl.h:
1822         * wtf/text/WTFString.h:
1823         (WTF::String::hasInfixStartingAt):
1824         (WTF::String::hasInfixEndingAt):
1825         (WTF::String::startsWith): Deleted.
1826         (WTF::String::endsWith): Deleted.
1827
1828 2015-03-05  Chris Dumez  <cdumez@apple.com>
1829
1830         NetworkCache efficacy logging is using too much CPU
1831         https://bugs.webkit.org/show_bug.cgi?id=142186
1832         <rdar://problem/19632080>
1833
1834         Reviewed by Antti Koivisto.
1835
1836         * wtf/HashMap.h:
1837         (WTF::copyToVector):
1838         Add copyToVector() utility function for HashMap that uses an std::pair<key, value>
1839         as element type.
1840
1841         * wtf/text/WTFString.h:
1842         (WTF::StringCapture::StringCapture):
1843         (WTF::StringCapture::operator=):
1844         Add default constructor and assignment operator to StringCapture so that
1845         it can be used in a Vector.
1846
1847 2015-03-05  Antti Koivisto  <antti@apple.com>
1848
1849         Support WorkQueue QOS classes on Mavericks
1850         https://bugs.webkit.org/show_bug.cgi?id=142328
1851
1852         Reviewed by Anders Carlsson.
1853
1854         "The priority of a dispatch queue is inherited from its target queue.  In order to
1855         change the priority of a queue created with dispatch_queue_create(), use the
1856         dispatch_get_global_queue() function to obtain a target queue of the desired prior-
1857         ity."
1858
1859         * wtf/cocoa/WorkQueueCocoa.cpp:
1860         (WTF::targetQueueForQOSClass):
1861         (WTF::WorkQueue::platformInitialize):
1862
1863 2015-03-03  Anders Carlsson  <andersca@apple.com>
1864
1865         Remove unused compression code
1866         https://bugs.webkit.org/show_bug.cgi?id=142237
1867
1868         Reviewed by Geoffrey Garen.
1869
1870         * WTF.vcxproj/WTF.vcxproj:
1871         * WTF.vcxproj/WTF.vcxproj.filters:
1872         * WTF.xcodeproj/project.pbxproj:
1873         * wtf/CMakeLists.txt:
1874         * wtf/Compression.cpp: Removed.
1875         * wtf/Compression.h: Removed.
1876
1877 2015-03-02  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
1878
1879         [WK2] Remove unnecessary create() factory functions.
1880         https://bugs.webkit.org/show_bug.cgi?id=142161
1881
1882         Reviewed by Chris Dumez.
1883
1884         We can replace some create() factory functions with std::make_unique(). Because
1885         it just returns new instance. Even some of those functions have used std::unique_ptr<>
1886         instead of std::make_unique<>. Fixed all.
1887
1888         * wtf/efl/WorkQueueEfl.cpp:
1889         (WorkQueue::dispatch):
1890
1891 2015-03-02  Filip Pizlo  <fpizlo@apple.com>
1892
1893         DFG compile time measurements should really report milliseconds
1894         https://bugs.webkit.org/show_bug.cgi?id=142209
1895
1896         Reviewed by Benjamin Poulain.
1897         
1898         This bug was introduced because currentTimeMS() calls were converted to
1899         monotonicallyIncreasingTime() calls. Perhaps this bug would be less likely if there was a
1900         monotonicallyIncreasingTimeMS() function available, so this patch adds it.
1901
1902         * wtf/CurrentTime.h:
1903         (WTF::monotonicallyIncreasingTimeMS):
1904
1905 2015-02-27  Darin Adler  <darin@apple.com>
1906
1907         Remove unused PossiblyNull
1908         https://bugs.webkit.org/show_bug.cgi?id=142124
1909
1910         Reviewed by Andreas Kling.
1911
1912         * WTF.vcxproj/WTF.vcxproj: Removed the file.
1913         * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
1914         * WTF.xcodeproj/project.pbxproj: Ditto.
1915         * wtf/CMakeLists.txt: Ditto.
1916         * wtf/PossiblyNull.h: Removed.
1917
1918         * wtf/FastMalloc.h: Moved everything to the left.
1919         Moved member functions out of the TryMallocReturnValue class definition.
1920         (WTF::TryMallocReturnValue::operator PossiblyNull<T>): Deleted.
1921         (WTF::TryMallocReturnValue::getValue): Marked inline, changed to work
1922         only with pointer types, not arbitrary non-pointer types.
1923
1924 2015-02-26  Brent Fulgham  <bfulgham@apple.com>
1925
1926         [Win] Make build logs more legible by reducing noise
1927         https://bugs.webkit.org/show_bug.cgi?id=142034
1928
1929         Reviewed by Alexey Proskuryakov.
1930
1931         Modify batch files, makefiles, and DOS commands to remove
1932         uninteresting/unhelpful output.
1933
1934         * WTF.vcxproj/WTFGenerated.make:
1935         * WTF.vcxproj/WTFPreBuild.cmd:
1936         * WTF.vcxproj/copy-files.cmd:
1937
1938 2015-02-26  Landry Breuil  <landry@openbsd.org>
1939
1940         Revert bug 19975, now that gcc 4.7 is required.
1941         https://bugs.webkit.org/show_bug.cgi?id=129927
1942
1943         Reviewed by Andreas Kling.
1944
1945         isfinite() and signbit() are provided by gcc's cmath header.
1946
1947         * wtf/MathExtras.h:
1948
1949 2015-02-26  Csaba Osztrogonác  <ossy@webkit.org>
1950
1951         UNREACHABLE_FOR_PLATFORM() should be release assert
1952         https://bugs.webkit.org/show_bug.cgi?id=141904
1953
1954         Reviewed by Darin Adler.
1955
1956         * wtf/Assertions.h:
1957         (UNREACHABLE_FOR_PLATFORM):
1958
1959 2015-02-25  Filip Pizlo  <fpizlo@apple.com>
1960
1961         Enable concurrent JIT on GTK
1962         https://bugs.webkit.org/show_bug.cgi?id=142007
1963
1964         Reviewed by Benjamin Poulain.
1965
1966         Seems weird that GTK keeps it off. No good reason for that as far as I can tell.
1967
1968         * wtf/Platform.h:
1969
1970 2015-02-23  Brent Fulgham  <bfulgham@apple.com>
1971
1972         WTF::WeakPtr should rename 'forgot' to 'clear' and support nullptr assignment
1973         https://bugs.webkit.org/show_bug.cgi?id=141935
1974
1975         Reviewed by Myles C. Maxfield.
1976
1977         * wtf/WeakPtr.h:
1978         (WTF::WeakPtr::operator=): Added 'nullptr_t' overload.
1979         (WTF::WeakPtr::clear): Renamed from 'forget'
1980         (WTF::WeakPtr::forget): Deleted.
1981
1982 2015-02-23  Brent Fulgham  <bfulgham@apple.com>
1983
1984         WTF::WeakPtr should have a 'forget' method
1985         https://bugs.webkit.org/show_bug.cgi?id=141923
1986
1987         Reviewed by Myles C. Maxfield.
1988
1989         * wtf/WeakPtr.h:
1990         (WTF::WeakPtr::forget): Added.
1991
1992 2015-02-20  Geoffrey Garen  <ggaren@apple.com>
1993
1994         Remove TCMalloc
1995         https://bugs.webkit.org/show_bug.cgi?id=141844
1996
1997         Reviewed by Andreas Kling.
1998
1999         It's unused.
2000
2001         * WTF.vcxproj/WTF.vcxproj:
2002         * WTF.vcxproj/WTF.vcxproj.filters:
2003         * WTF.xcodeproj/project.pbxproj:
2004         * wtf/CMakeLists.txt:
2005         * wtf/FastMalloc.cpp:
2006         (WTF::EntropySource<4>::value): Deleted.
2007         (WTF::EntropySource<8>::value): Deleted.
2008         (WTF::internalEntropyValue): Deleted.
2009         (WTF::freedObjectStartPoison): Deleted.
2010         (WTF::freedObjectEndPoison): Deleted.
2011         (WTF::ClassIndex): Deleted.
2012         (WTF::HardenedSLL::create): Deleted.
2013         (WTF::HardenedSLL::null): Deleted.
2014         (WTF::HardenedSLL::setValue): Deleted.
2015         (WTF::HardenedSLL::value): Deleted.
2016         (WTF::HardenedSLL::operator!): Deleted.
2017         (WTF::HardenedSLL::operator UnspecifiedBoolType): Deleted.
2018         (WTF::HardenedSLL::operator!=): Deleted.
2019         (WTF::HardenedSLL::operator==): Deleted.
2020         (WTF::LgFloor): Deleted.
2021         (WTF::SLL_Next): Deleted.
2022         (WTF::SLL_SetNext): Deleted.
2023         (WTF::SLL_Push): Deleted.
2024         (WTF::SLL_Pop): Deleted.
2025         (WTF::SLL_PopRange): Deleted.
2026         (WTF::SLL_PushRange): Deleted.
2027         (WTF::SizeClass): Deleted.
2028         (WTF::ByteSizeForClass): Deleted.
2029         (WTF::NumMoveSize): Deleted.
2030         (WTF::InitSizeClasses): Deleted.
2031         (WTF::MetaDataAlloc): Deleted.
2032         (WTF::PageHeapAllocator::Init): Deleted.
2033         (WTF::PageHeapAllocator::New): Deleted.
2034         (WTF::PageHeapAllocator::Delete): Deleted.
2035         (WTF::PageHeapAllocator::inuse): Deleted.
2036         (WTF::pages): Deleted.
2037         (WTF::AllocationSize): Deleted.
2038         (WTF::spanInitializerCookie): Deleted.
2039         (WTF::Span::next): Deleted.
2040         (WTF::Span::remoteNext): Deleted.
2041         (WTF::Span::prev): Deleted.
2042         (WTF::Span::setNext): Deleted.
2043         (WTF::Span::setPrev): Deleted.
2044         (WTF::Span::initCookie): Deleted.
2045         (WTF::Span::clearCookie): Deleted.
2046         (WTF::Span::isValid): Deleted.
2047         (WTF::Event): Deleted.
2048         (WTF::NewSpan): Deleted.
2049         (WTF::DeleteSpan): Deleted.
2050         (WTF::DLL_Init): Deleted.
2051         (WTF::DLL_Remove): Deleted.
2052         (WTF::DLL_IsEmpty): Deleted.
2053         (WTF::DLL_Length): Deleted.
2054         (WTF::DLL_Print): Deleted.
2055         (WTF::DLL_Prepend): Deleted.
2056         (WTF::TCMalloc_Central_FreeList::length): Deleted.
2057         (WTF::TCMalloc_Central_FreeList::tc_length): Deleted.
2058         (WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Deleted.
2059         (WTF::TCMalloc_Central_FreeList::entropy): Deleted.
2060         (WTF::FastMallocZone::goodSize): Deleted.
2061         (WTF::FastMallocZone::check): Deleted.
2062         (WTF::FastMallocZone::print): Deleted.
2063         (WTF::FastMallocZone::log): Deleted.
2064         (WTF::FastMallocZone::forceLock): Deleted.
2065         (WTF::FastMallocZone::forceUnlock): Deleted.
2066         (WTF::FastMallocZone::statistics): Deleted.
2067         (WTF::FastMallocZone::zoneValloc): Deleted.
2068         (WTF::FastMallocZone::zoneDestroy): Deleted.
2069         (WTF::MallocHook::record): Deleted.
2070         (WTF::MallocHook::recordAllocation): Deleted.
2071         (WTF::MallocHook::recordDeallocation): Deleted.
2072         (WTF::MallocHook::init): Deleted.
2073         (WTF::MallocHook::InvokeNewHook): Deleted.
2074         (WTF::MallocHook::InvokeDeleteHook): Deleted.
2075         (WTF::KernelSupportsTLS): Deleted.
2076         (WTF::CheckIfKernelSupportsTLS): Deleted.
2077         (WTF::TCMalloc_PageHeap::GetDescriptor): Deleted.
2078         (WTF::TCMalloc_PageHeap::GetDescriptorEnsureSafe): Deleted.
2079         (WTF::TCMalloc_PageHeap::SystemBytes): Deleted.
2080         (WTF::TCMalloc_PageHeap::FreeBytes): Deleted.
2081         (WTF::TCMalloc_PageHeap::GetSizeClassIfCached): Deleted.
2082         (WTF::TCMalloc_PageHeap::CacheSizeClass): Deleted.
2083         (WTF::TCMalloc_PageHeap::RecordSpan): Deleted.
2084         (WTF::TCMalloc_PageHeap::init): Deleted.
2085         (WTF::TCMalloc_PageHeap::initializeScavenger): Deleted.
2086         (WTF::TCMalloc_PageHeap::isScavengerSuspended): Deleted.
2087         (WTF::TCMalloc_PageHeap::scheduleScavenger): Deleted.
2088         (WTF::TCMalloc_PageHeap::rescheduleScavenger): Deleted.
2089         (WTF::TCMalloc_PageHeap::suspendScavenger): Deleted.
2090         (WTF::TCMalloc_PageHeap::scavengerTimerFired): Deleted.
2091         (WTF::TCMalloc_PageHeap::runScavengerThread): Deleted.
2092         (WTF::TCMalloc_PageHeap::signalScavenger): Deleted.
2093         (WTF::TCMalloc_PageHeap::scavenge): Deleted.
2094         (WTF::TCMalloc_PageHeap::shouldScavenge): Deleted.
2095         (WTF::TCMalloc_PageHeap::New): Deleted.
2096         (WTF::TCMalloc_PageHeap::AllocLarge): Deleted.
2097         (WTF::TCMalloc_PageHeap::Split): Deleted.
2098         (WTF::TCMalloc_PageHeap::Carve): Deleted.
2099         (WTF::mergeDecommittedStates): Deleted.
2100         (WTF::TCMalloc_PageHeap::Delete): Deleted.
2101         (WTF::TCMalloc_PageHeap::IncrementalScavenge): Deleted.
2102         (WTF::TCMalloc_PageHeap::RegisterSizeClass): Deleted.
2103         (WTF::TCMalloc_PageHeap::ReturnedBytes): Deleted.
2104         (WTF::PagesToMB): Deleted.
2105         (WTF::TCMalloc_PageHeap::Dump): Deleted.
2106         (WTF::TCMalloc_PageHeap::GrowHeap): Deleted.
2107         (WTF::TCMalloc_PageHeap::Check): Deleted.
2108         (WTF::TCMalloc_PageHeap::CheckList): Deleted.
2109         (WTF::TCMalloc_PageHeap::ReleaseFreeList): Deleted.
2110         (WTF::TCMalloc_PageHeap::ReleaseFreePages): Deleted.
2111         (WTF::TCMalloc_ThreadCache_FreeList::Init): Deleted.
2112         (WTF::TCMalloc_ThreadCache_FreeList::length): Deleted.
2113         (WTF::TCMalloc_ThreadCache_FreeList::empty): Deleted.
2114         (WTF::TCMalloc_ThreadCache_FreeList::lowwatermark): Deleted.
2115         (WTF::TCMalloc_ThreadCache_FreeList::clear_lowwatermark): Deleted.
2116         (WTF::TCMalloc_ThreadCache_FreeList::Push): Deleted.
2117         (WTF::TCMalloc_ThreadCache_FreeList::PushRange): Deleted.
2118         (WTF::TCMalloc_ThreadCache_FreeList::PopRange): Deleted.
2119         (WTF::TCMalloc_ThreadCache_FreeList::Pop): Deleted.
2120         (WTF::TCMalloc_ThreadCache_FreeList::Validate): Deleted.
2121         (WTF::TCMalloc_ThreadCache_FreeList::enumerateFreeObjects): Deleted.
2122         (WTF::TCMalloc_ThreadCache::freelist_length): Deleted.
2123         (WTF::TCMalloc_ThreadCache::Size): Deleted.
2124         (WTF::TCMalloc_ThreadCache::enumerateFreeObjects): Deleted.
2125         (WTF::getPageHeap): Deleted.
2126         (WTF::fastMallocGoodSize): Deleted.
2127         (WTF::TCMalloc_PageHeap::periodicScavenge): Deleted.
2128         (WTF::TCMalloc_PageHeap::scavengerThread): Deleted.
2129         (WTF::setThreadHeap): Deleted.
2130         (WTF::TCMalloc_Central_FreeList::Init): Deleted.
2131         (WTF::TCMalloc_Central_FreeList::ReleaseListToSpans): Deleted.
2132         (WTF::TCMalloc_Central_FreeList::ReleaseToSpans): Deleted.
2133         (WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass): Deleted.
2134         (WTF::TCMalloc_Central_FreeList::MakeCacheSpace): Deleted.
2135         (WTF::TCMalloc_Central_FreeList::ShrinkCache): Deleted.
2136         (WTF::TCMalloc_Central_FreeList::InsertRange): Deleted.
2137         (WTF::TCMalloc_Central_FreeList::RemoveRange): Deleted.
2138         (WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe): Deleted.
2139         (WTF::TCMalloc_Central_FreeList::FetchFromSpans): Deleted.
2140         (WTF::TCMalloc_Central_FreeList::Populate): Deleted.
2141         (WTF::TCMalloc_ThreadCache::SampleAllocation): Deleted.
2142         (WTF::TCMalloc_ThreadCache::Init): Deleted.
2143         (WTF::TCMalloc_ThreadCache::Cleanup): Deleted.
2144         (WTF::TCMalloc_ThreadCache::Allocate): Deleted.
2145         (WTF::TCMalloc_ThreadCache::Deallocate): Deleted.
2146         (WTF::TCMalloc_ThreadCache::FetchFromCentralCache): Deleted.
2147         (WTF::TCMalloc_ThreadCache::ReleaseToCentralCache): Deleted.
2148         (WTF::TCMalloc_ThreadCache::Scavenge): Deleted.
2149         (WTF::TCMalloc_ThreadCache::PickNextSample): Deleted.
2150         (WTF::TCMalloc_ThreadCache::InitModule): Deleted.
2151         (WTF::TCMalloc_ThreadCache::NewHeap): Deleted.
2152         (WTF::TCMalloc_ThreadCache::GetThreadHeap): Deleted.
2153         (WTF::TCMalloc_ThreadCache::GetCache): Deleted.
2154         (WTF::TCMalloc_ThreadCache::GetCacheIfPresent): Deleted.
2155         (WTF::TCMalloc_ThreadCache::InitTSD): Deleted.
2156         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): Deleted.
2157         * wtf/TCPackedCache.h: Removed.
2158         * wtf/TCPageMap.h: Removed.
2159         * wtf/TCSystemAlloc.cpp: Removed.
2160         * wtf/TCSystemAlloc.h: Removed.
2161
2162 2015-02-20  Alexey Proskuryakov  <ap@apple.com>
2163
2164         Remove svn:keywords property.
2165
2166         As far as I can tell, the property had no effect on any of these files, but also,
2167         when it has effect it's likely harmful.
2168
2169         * wtf/DecimalNumber.cpp: Removed property svn:keywords.
2170         * wtf/spi/darwin/XPCSPI.h: Removed property svn:keywords.
2171
2172 2015-02-20  Csaba Osztrogonác  <ossy@webkit.org>
2173
2174         EFL URTBF
2175
2176         * wtf/PlatformEfl.cmake:
2177
2178 2015-02-20  Simon Fraser  <simon.fraser@apple.com>
2179
2180         RunLoop::dispatch() should drop the mutex before calling wakeUp().
2181         https://bugs.webkit.org/show_bug.cgi?id=141820
2182
2183         Reviewed by Alexey Proskuryakov.
2184         
2185         RunLoop::wakeUp() calls into CoreFoundation which could take time,
2186         so scope the mutex just to protect m_functionQueue.
2187
2188         * wtf/RunLoop.cpp:
2189         (WTF::RunLoop::dispatch):
2190
2191 2015-02-20  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2192
2193         Unreviewed, EFL build fix since r180410.
2194
2195         * wtf/PlatformEfl.cmake: Add WEBKIT2/Platform/efl path in order to include DispatchQueueEfl.h.
2196
2197 2015-02-20  Antti Koivisto  <antti@apple.com>
2198
2199         Move WorkQueue from WK2 to WTF
2200         https://bugs.webkit.org/show_bug.cgi?id=141797
2201
2202         Reviewed by Anders Carlsson.
2203
2204         It may be useful in WebCore.
2205
2206         Windows implementation is still missing.
2207
2208         * WTF.xcodeproj/project.pbxproj:
2209         * wtf/CMakeLists.txt:
2210         * wtf/PlatformGTK.cmake:
2211         * wtf/WorkQueue.cpp: Copied from Source/WebKit2/Platform/WorkQueue.cpp.
2212         * wtf/WorkQueue.h: Copied from Source/WebKit2/Platform/WorkQueue.h.
2213         * wtf/cocoa: Added.
2214         * wtf/cocoa/WorkQueueCocoa.cpp: Copied from Source/WebKit2/Platform/mac/WorkQueueMac.cpp.
2215         * wtf/efl/WorkQueueEfl.cpp: Copied from Source/WebKit2/Platform/efl/WorkQueueEfl.cpp.
2216         * wtf/gtk/WorkQueueGtk.cpp: Copied from Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp.
2217
2218 2015-02-13  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2219
2220         [EFL] Enable bmalloc for EFL port 
2221         https://bugs.webkit.org/show_bug.cgi?id=141459
2222
2223         Reviewed by Csaba Osztrogonác.
2224
2225         * wtf/CMakeLists.txt: Remove TCSystemAlloc.cpp/h.
2226         * wtf/FastMalloc.cpp: Enable BMALLOC for EFL port.
2227
2228 2015-02-13  Anders Carlsson  <andersca@apple.com>
2229
2230         Add a move constructor and move assignment operator to Deque
2231         https://bugs.webkit.org/show_bug.cgi?id=141571
2232
2233         Reviewed by Andreas Kling.
2234
2235         * wtf/Deque.h:
2236         (WTF::inlineCapacity>::Deque):
2237         (WTF::=): Deleted.
2238
2239 2015-02-13  Anders Carlsson  <andersca@apple.com>
2240
2241         Add an initializer list constructor to Deque
2242         https://bugs.webkit.org/show_bug.cgi?id=141565
2243
2244         Reviewed by Andreas Kling.
2245
2246         * wtf/Deque.h:
2247         (WTF::inlineCapacity>::Deque):
2248
2249 2015-02-13  Anders Carlsson  <andersca@apple.com>
2250
2251         Re-indent Deque.h
2252
2253         Rubber-stamped by Antti Koivisto.
2254
2255         * wtf/Deque.h:
2256
2257 2015-02-11  Brent Fulgham  <bfulgham@apple.com>
2258
2259         [Win] [64-bit] Work around MSVC2013 Runtime Bug
2260         https://bugs.webkit.org/show_bug.cgi?id=141498
2261         <rdar://problem/19803642>
2262
2263         Reviewed by Anders Carlsson.
2264
2265         Disable FMA3 instruction use in the MSVC math library to
2266         work around a VS2013 runtime crash. We can remove this
2267         workaround when we switch to VS2015.
2268
2269         * WTF.vcxproj/WTF.vcxproj: Add new files.
2270         * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
2271         * wtf/win/WTFDLL.cpp: Added.
2272
2273 2015-02-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2274
2275         [EFL][GTK] Use bmalloc instead of tcmalloc
2276         https://bugs.webkit.org/show_bug.cgi?id=140162
2277
2278         Reviewed by Carlos Garcia Campos.
2279
2280         * wtf/CMakeLists.txt:
2281         * wtf/FastMalloc.cpp:
2282             Enable bmalloc on GTK ports, but EFL port will enable it when bmalloc supports
2283             memory statistics.
2284
2285 2015-02-10  Darin Adler  <darin@apple.com>
2286
2287         Add the crash-on-failure behavior to bmalloc-based fastMalloc
2288         https://bugs.webkit.org/show_bug.cgi?id=141434
2289
2290         Reviewed by Alexey Proskuryakov.
2291
2292         * wtf/FastMalloc.cpp: Removed unneeded includes.
2293         (WTF::fastMalloc): Added null check and CRASH.
2294         (WTF::fastCalloc): Added overflow checking, null check, and CRASH.
2295         (WTF::fastRealloc): Added null check and CRASH.
2296         (WTF::fastMallocSize): Added FIXME comment.
2297         (WTF::fastMallocGoodSize): Added FIXME comment.
2298         (WTF::fastAlignedMalloc): Added null check and CRASH.
2299         (WTF::tryFastMalloc): Changed to call bmalloc directly instead of
2300         calling fastMalloc, since fastMalloc will now crash on failure.
2301         (WTF::tryFastRealloc): Changed to call bmalloc directly instead of
2302         calling fastRealloc, since fastRealloc will now crash on failure.
2303         (WTF::tryFastCalloc): Added overflow checking.
2304         (WTF::fastMallocStatistics): Added FIXME comment.
2305
2306 2015-02-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2307
2308         [GTK] GMutexLocker build issue
2309         https://bugs.webkit.org/show_bug.cgi?id=141381
2310
2311         Reviewed by Žan Doberšek.
2312
2313         Remove using WTF::GMutexLocker from the header, since newer glib
2314         versions have a GMutexLocker in the public API.
2315
2316         * wtf/gobject/GMutexLocker.h:
2317
2318 2015-02-09  Alexey Proskuryakov  <ap@apple.com>
2319
2320         REGRESSION: tryFastCalloc is no longer "try"
2321         https://bugs.webkit.org/show_bug.cgi?id=141406
2322
2323         Reviewed by Darin Adler.
2324
2325         This causes crashes on some WebKit regression test bots.
2326
2327         * wtf/FastMalloc.cpp: (WTF::tryFastCalloc): Fix what looks like a copy/paste mistake.
2328
2329 2015-02-07  Csaba Osztrogonác  <ossy@webkit.org>
2330
2331         [ARM] GC sometimes stuck in an infinite loop if parallel GC is enabled
2332         https://bugs.webkit.org/show_bug.cgi?id=141290
2333
2334         Reviewed by Anders Carlsson.
2335
2336         * wtf/Platform.h:
2337
2338 2015-02-07  Chris Dumez  <cdumez@apple.com>
2339
2340         Add Vector::removeFirstMatching() / removeAllMatching() methods taking lambda functions
2341         https://bugs.webkit.org/show_bug.cgi?id=141321
2342
2343         Reviewed by Darin Adler.
2344
2345         Add Vector::removeFirstMatching() / removeAllMatching() methods taking
2346         lambda functions to match the element(s) to remove. This simplifies the
2347         code a bit. Vector::removeAllMatching() is also more efficient than the
2348         manual removal alternative.
2349
2350         * wtf/Vector.h:
2351
2352 2015-02-06  Commit Queue  <commit-queue@webkit.org>
2353
2354         Unreviewed, rolling out r179743.
2355         https://bugs.webkit.org/show_bug.cgi?id=141335
2356
2357         caused missing symbols in non-WebKit clients of WTF::Vector
2358         (Requested by kling on #webkit).
2359
2360         Reverted changeset:
2361
2362         "Remove WTF::fastMallocGoodSize()."
2363         https://bugs.webkit.org/show_bug.cgi?id=141020
2364         http://trac.webkit.org/changeset/179743
2365
2366 2015-02-06  Andreas Kling  <akling@apple.com>
2367
2368         Remove WTF::fastMallocGoodSize().
2369         <https://webkit.org/b/141020>
2370
2371         Reviewed by Anders Carlsson.
2372
2373         bmalloc's good-size API just returns exactly whatever you pass it,
2374         so it's of no utility to us anymore.
2375
2376         This gets rid of a bunch of pointless out-of-line calls in Vector
2377         construction and growth.
2378
2379         * wtf/Compression.cpp:
2380         (WTF::GenericCompressedData::create):
2381         * wtf/FastMalloc.cpp:
2382         (WTF::fastMallocGoodSize): Deleted.
2383         * wtf/FastMalloc.h:
2384         * wtf/Vector.h:
2385         (WTF::VectorBufferBase::allocateBuffer):
2386         (WTF::VectorBufferBase::tryAllocateBuffer):
2387         (WTF::VectorBufferBase::reallocateBuffer):
2388
2389 2015-02-05  Youenn Fablet  <youenn.fablet@crf.canon.fr> and Xabier Rodriguez Calvar <calvaris@igalia.com>
2390
2391         [Streams API] Implement a barebone ReadableStream interface
2392         https://bugs.webkit.org/show_bug.cgi?id=141045
2393
2394         Reviewed by Benjamin Poulain.
2395
2396         * wtf/FeatureDefines.h:
2397
2398 2015-02-04  Alexey Proskuryakov  <ap@apple.com>
2399
2400         Optimized equal() functions in StringImpl.h are not ASan compatible
2401         https://bugs.webkit.org/show_bug.cgi?id=141258
2402
2403         Reviewed by Daniel Bates.
2404
2405         * wtf/text/StringImpl.h: (WTF::equal): Add custom implementations for ASan.
2406
2407 2015-02-04  Chris Dumez  <cdumez@apple.com>
2408
2409         Add removeFirst(value) / removeAll(value) methods to WTF::Vector
2410         https://bugs.webkit.org/show_bug.cgi?id=141192
2411
2412         Reviewed by Benjamin Poulain.
2413
2414         Add removeFirst(value) / removeAll(value) convenience methods to
2415         WTF::Vector to reduce complexity a bit at call sites.
2416
2417         I am planning to add overloads for these taking a lambda function for
2418         matching in a follow-up patch as well. I have seen quite a few
2419         Vector::remove(index) call sites that would benefit from it.
2420
2421         * wtf/Vector.h:
2422         (WTF::OverflowHandler>::removeFirst):
2423         (WTF::OverflowHandler>::removeAll):
2424
2425 2015-02-02  Dhi Aurrahman  <diorahman@rockybars.com>
2426
2427         Optimize matchesLangPseudoClass() of :lang()
2428         https://bugs.webkit.org/show_bug.cgi?id=140873
2429
2430         Reviewed by Darin Adler.
2431
2432         Add some basic equality comparison operators.
2433
2434         * wtf/text/StringView.h:
2435         (WTF::operator==):
2436         (WTF::operator!=):
2437         (WTF::equal):
2438         (WTF::equalIgnoringASCIICase):
2439
2440 2015-02-02  Geoffrey Garen  <ggaren@apple.com>
2441
2442         Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages
2443         https://bugs.webkit.org/show_bug.cgi?id=140900
2444
2445         Reviewed by Mark Hahnenberg.
2446
2447         Re-landing just the HandleBlock piece of this patch.
2448
2449         * wtf/FastMalloc.cpp:
2450         (WTF::fastAlignedMalloc):
2451         (WTF::fastAlignedFree):
2452         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2453         * wtf/FastMalloc.h:
2454
2455 2015-02-02  Daniel Bates  <dabates@apple.com>
2456
2457         [iOS] ASSERTION FAILED: m_scriptExecutionContext->isContextThread() in ContextDestructionObserver::observeContext
2458         https://bugs.webkit.org/show_bug.cgi?id=141057
2459         <rdar://problem/19068790>
2460
2461         Reviewed by Alexey Proskuryakov.
2462
2463         * wtf/MainThread.h:
2464         * wtf/mac/MainThreadMac.mm:
2465         (WTF::callOnWebThreadOrDispatchAsyncOnMainThread): Added.
2466
2467 2015-01-31  Sam Weinig  <sam@webkit.org>
2468
2469         Remove even more Mountain Lion support
2470         https://bugs.webkit.org/show_bug.cgi?id=141124
2471
2472         Reviewed by Alexey Proskuryakov.
2473
2474         * Configurations/Base.xcconfig:
2475         * Configurations/DebugRelease.xcconfig:
2476         * wtf/Assertions.cpp:
2477         * wtf/FeatureDefines.h:
2478         * wtf/Platform.h:
2479
2480 2015-01-31  Commit Queue  <commit-queue@webkit.org>
2481
2482         Unreviewed, rolling out r179426.
2483         https://bugs.webkit.org/show_bug.cgi?id=141119
2484
2485         "caused a memory use regression" (Requested by Guest45 on
2486         #webkit).
2487
2488         Reverted changeset:
2489
2490         "Use FastMalloc (bmalloc) instead of BlockAllocator for GC
2491         pages"
2492         https://bugs.webkit.org/show_bug.cgi?id=140900
2493         http://trac.webkit.org/changeset/179426
2494
2495 2015-01-31  Commit Queue  <commit-queue@webkit.org>
2496
2497         Unreviewed, rolling out r179408.
2498         https://bugs.webkit.org/show_bug.cgi?id=141117
2499
2500         This didn't fully fix the issue (Requested by anttik on
2501         #webkit).
2502
2503         Reverted changeset:
2504
2505         "OSObjectPtr does not work with dispatch_data_t on Maverics"
2506         https://bugs.webkit.org/show_bug.cgi?id=141081
2507         http://trac.webkit.org/changeset/179408
2508
2509 2015-01-30  Yusuke Suzuki  <utatane.tea@gmail.com>
2510
2511         Implement ES6 Symbol
2512         https://bugs.webkit.org/show_bug.cgi?id=140435
2513
2514         Reviewed by Geoffrey Garen.
2515
2516         Introduce new unique string mechanizm into StringImpl.
2517         It is used for implementing Symbol which holds a [[Description]] value.
2518
2519         * wtf/text/AtomicString.h:
2520         (WTF::AtomicString::add):
2521         (WTF::AtomicString::addWithStringTableProvider):
2522
2523         Previously, we checked `isAtomic()` or `!length()`. This guard can filter out EmptyUnique.
2524         But now, we introduced new unique StringImpl. Since it has an actual string value, we need to check `isUnique()`.
2525
2526         * wtf/text/StringImpl.cpp:
2527         (WTF::StringImpl::~StringImpl):
2528         (WTF::StringImpl::createUnique):
2529
2530         In createUnique, we leverage Substring mechanizm to produce a new unique
2531         string from an existing string.
2532
2533         * wtf/text/StringImpl.h:
2534         (WTF::StringImpl::StringImpl):
2535         (WTF::StringImpl::createUniqueEmpty):
2536         (WTF::StringImpl::flagIsUnique):
2537         (WTF::StringImpl::isUnique):
2538         (WTF::StringImpl::setIsAtomic):
2539         (WTF::StringImpl::createEmptyUnique): Deleted.
2540         (WTF::StringImpl::isEmptyUnique): Deleted.
2541
2542         Instead of EmptyUnique, we introduced new flag to StringImpl, `isUnique`.
2543         While EmptyUnique cannot hold any string values except for empty string,
2544         the unique StringImpl can hold any String values.
2545         We fold the Symbol's descriptiveString value here.
2546
2547         * wtf/text/StringStatics.cpp:
2548         (WTF::StringImpl::hashAndFlagsForUnique):
2549         (WTF::StringImpl::hashAndFlagsForEmptyUnique): Deleted.
2550
2551 2015-01-30  Geoffrey Garen  <ggaren@apple.com>
2552
2553         Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages
2554         https://bugs.webkit.org/show_bug.cgi?id=140900
2555
2556         Reviewed by Mark Hahnenberg.
2557
2558         Re-landing just the HandleBlock piece of this patch.
2559
2560         * wtf/FastMalloc.cpp:
2561         (WTF::fastAlignedMalloc):
2562         (WTF::fastAlignedFree):
2563         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2564         * wtf/FastMalloc.h:
2565
2566 2015-01-30  Namhoon Kim  <yanhkim@gmail.com>
2567
2568         Call vsnprintf instead of _vsnprintf in vprintf_stderr_common
2569         https://bugs.webkit.org/show_bug.cgi?id=141078
2570
2571         In windows _vsnprintf api does not place null character
2572         automatically. Simply replace it with vsnprintf. Which is
2573         polyfill to call wtf_vsnprintf in windows.
2574
2575         Reviewed by Brent Fulgham.
2576
2577         * wtf/Assertions.cpp:
2578
2579 2015-01-30  Brian J. Burg  <burg@cs.washington.edu>
2580
2581         Web Inspector: ASSERT in InspectorTimelineAgent::internalStop
2582         https://bugs.webkit.org/show_bug.cgi?id=141039
2583
2584         Reviewed by Timothy Hatcher.
2585
2586         Add messages to Stopwatch assertions, and clean up constructor.
2587
2588         * wtf/Stopwatch.h:
2589         (WTF::Stopwatch::Stopwatch):
2590         (WTF::Stopwatch::start):
2591         (WTF::Stopwatch::stop):
2592
2593 2015-01-30  Chris Dumez  <cdumez@apple.com>
2594
2595         Add match_constness<Reference, T> helper struct
2596         https://bugs.webkit.org/show_bug.cgi?id=140905
2597
2598         Reviewed by Benjamin Poulain.
2599
2600         Add match_constness<Reference, T> helper struct to simplify downcast<>()
2601         a bit. The purpose of this helper is to update T's constness to match
2602         Reference's.
2603
2604         * wtf/TypeCasts.h:
2605         (WTF::downcast):
2606
2607 2015-01-30  Chris Dumez  <cdumez@apple.com>
2608
2609         Add assertion in RefPtr's operator*() to make sure we don't dereference nullptr
2610         https://bugs.webkit.org/show_bug.cgi?id=141092
2611
2612         Reviewed by Anders Carlsson.
2613
2614         Add assertion in RefPtr's operator*() to make sure we don't dereference
2615         nullptr.
2616
2617         * wtf/RefPtr.h:
2618         (WTF::RefPtr::operator*):
2619
2620 2015-01-30  Geoffrey Garen  <ggaren@apple.com>
2621
2622         GC marking threads should clear malloc caches
2623         https://bugs.webkit.org/show_bug.cgi?id=141097
2624
2625         Reviewed by Andreas Kling.
2626
2627         Split the scavenging API into per-thread vs global, so that you can
2628         request to scavenge your own thread without scavenging the whole heap.
2629
2630         * wtf/FastMalloc.cpp:
2631         (WTF::releaseFastMallocFreeMemoryForThisThread):
2632         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2633         * wtf/FastMalloc.h:
2634
2635 2015-01-30  Antti Koivisto  <antti@apple.com>
2636
2637         OSObjectPtr does not work with dispatch_data_t on Maverics
2638         https://bugs.webkit.org/show_bug.cgi?id=141081
2639
2640         Reviewed by Pratik Solanki.
2641         
2642         Trying to use OSObjectPtr<dispatch_data_t> throws 
2643         
2644         -[OS_dispatch_data _xref_dispose]: unrecognized selector sent to instance 0
2645
2646         * wtf/OSObjectPtr.h:
2647         (WTF::retainOSObject<dispatch_data_t>):
2648         (WTF::releaseOSObject<dispatch_data_t>):
2649         
2650             Add specialization for dispatch_data_t on Maverics.
2651
2652 2015-01-29  Santosh Mahto  <santoshbit2007@gmail.com>
2653
2654         Refactor String::format to handle unreached va_end.
2655         https://bugs.webkit.org/show_bug.cgi?id=140938
2656
2657         Reviewed by Alexey Proskuryakov.
2658
2659         Now va_end is called for all platform after getting length
2660         of formatted string and again va_start/va_end is called to write
2661         formatted string in buffer. This way it ensure va_end is always
2662         reached for each va_start.
2663
2664         * wtf/text/WTFString.cpp:
2665
2666 2015-01-29  Csaba Osztrogonác  <ossy@webkit.org>
2667
2668         Move HAVE_DTRACE definition back to Platform.h
2669         https://bugs.webkit.org/show_bug.cgi?id=141033
2670
2671         Reviewed by Dan Bernstein.
2672
2673         * wtf/Platform.h:
2674
2675 2015-01-28  Namhoon Kim  <namkim@ea.com>
2676
2677         Windows return -1 when calling vsnprintf with arguments that exceed target buffer size
2678         https://bugs.webkit.org/show_bug.cgi?id=140917
2679
2680         Reviewed by Brent Fulgham.
2681
2682         Fix return value of vsnprintf when windows API return -1 to denote
2683         requested buffer exceeded. Replace return value by calling vscprintf.
2684
2685         * wtf/StringExtras.h:
2686         (snprintf): Fix return value by calling vscprintf when buffer exceeded.
2687         (wtf_vsnprintf): Ditto.
2688
2689 2015-01-28  Geoffrey Garen  <ggaren@apple.com>
2690
2691         Removed fastMallocForbid / fastMallocAllow
2692         https://bugs.webkit.org/show_bug.cgi?id=141012
2693
2694         Reviewed by Mark Hahnenberg.
2695
2696         Removed the forbid / allow API because it is no longer used.
2697
2698         * wtf/FastMalloc.cpp:
2699         (WTF::tryFastMalloc):
2700         (WTF::fastMalloc):
2701         (WTF::tryFastCalloc):
2702         (WTF::fastCalloc):
2703         (WTF::fastFree):
2704         (WTF::tryFastRealloc):
2705         (WTF::fastRealloc):
2706         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2707         (WTF::isForbidden): Deleted.
2708         (WTF::fastMallocForbid): Deleted.
2709         (WTF::fastMallocAllow): Deleted.
2710         (WTF::initializeIsForbiddenKey): Deleted.
2711         * wtf/FastMalloc.h:
2712
2713 2015-01-28  Dana Burkart  <dburkart@apple.com>
2714
2715         Move ASan flag settings from DebugRelease.xcconfig to Base.xcconfig
2716         https://bugs.webkit.org/show_bug.cgi?id=136765
2717
2718         Reviewed by Alexey Proskuryakov.
2719
2720         * Configurations/Base.xcconfig:
2721         * Configurations/DebugRelease.xcconfig:
2722
2723 2015-01-28  Darin Adler  <darin@apple.com>
2724
2725         Fix small leak in Collator
2726         https://bugs.webkit.org/show_bug.cgi?id=140990
2727
2728         Reviewed by Andreas Kling.
2729
2730         * wtf/unicode/icu/CollatorICU.cpp:
2731         (WTF::Collator::Collator): Use fastStrDup instead of strdup.
2732         (WTF::Collator::~Collator): Use fastFree on the collator locale that we
2733         are abandoning. The old code instead just called free on a null pointer.
2734
2735 2015-01-27  Geoffrey Garen  <ggaren@apple.com>
2736
2737         Removed WTF_MALLOC_VALIDATION
2738         https://bugs.webkit.org/show_bug.cgi?id=140958
2739
2740         Reviewed by Anders Carlsson.
2741
2742         I don't think anyone has been using this, and the #ifdefs were driving
2743         me crazy.
2744
2745         We have other options for validation -- like MallocGuardEdges,
2746         MallocCheckHeapEach, MallocScribble, and GuardMalloc.
2747
2748         * wtf/FastMalloc.cpp:
2749         (WTF::tryFastMalloc):
2750         (WTF::fastMalloc):
2751         (WTF::tryFastCalloc):
2752         (WTF::fastCalloc):
2753         (WTF::fastFree):
2754         (WTF::tryFastRealloc):
2755         (WTF::fastRealloc):
2756         (WTF::fastMallocSize):
2757         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2758         (WTF::Internal::fastMallocMatchFailed): Deleted.
2759         * wtf/FastMalloc.h:
2760         (WTF::Internal::fastMallocValidationHeader): Deleted.
2761         (WTF::Internal::fastMallocValidationSuffix): Deleted.
2762         (WTF::Internal::fastMallocMatchValidationType): Deleted.
2763         (WTF::Internal::setFastMallocMatchValidationType): Deleted.
2764         (WTF::fastMallocMatchValidateMalloc): Deleted.
2765         (WTF::fastMallocMatchValidateFree): Deleted.
2766         (WTF::fastMallocValidate): Deleted.
2767
2768 2015-01-27  Commit Queue  <commit-queue@webkit.org>
2769
2770         Unreviewed, rolling out r179192.
2771         https://bugs.webkit.org/show_bug.cgi?id=140953
2772
2773         Caused numerous layout test failures (Requested by mattbaker_
2774         on #webkit).
2775
2776         Reverted changeset:
2777
2778         "Use FastMalloc (bmalloc) instead of BlockAllocator for GC
2779         pages"
2780         https://bugs.webkit.org/show_bug.cgi?id=140900
2781         http://trac.webkit.org/changeset/179192
2782
2783 2015-01-26  Geoffrey Garen  <ggaren@apple.com>
2784
2785         Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages
2786         https://bugs.webkit.org/show_bug.cgi?id=140900
2787
2788         Reviewed by Mark Hahnenberg.
2789
2790         New interface for aligned allocation: fastAlignedMalloc / fastAlignedFree.
2791         We require a special function call on free because Windows.
2792
2793         * wtf/FastMalloc.cpp:
2794         (WTF::fastAlignedMalloc):
2795         (WTF::fastAlignedFree): Do it.
2796
2797         (WTF::do_memalign): Un-ifdef this, since we use it now.
2798
2799         * wtf/FastMalloc.h: Make our new function names visible like the rest
2800         of fastMalloc.
2801
2802 2015-01-26  Brent Fulgham  <bfulgham@apple.com>
2803
2804         [Win] ASSERTION FAILED !m_ptr under AccessibilityController::winAddNotificationListener
2805         https://bugs.webkit.org/show_bug.cgi?id=87426
2806         <rdar://problem/11527899>
2807
2808         Reviewed by Darin Adler.
2809
2810         Revise internal containers to use std::addressof in preference to
2811         to using the '&' operator.
2812
2813         * wtf/Deque.h:
2814         (WTF::inlineCapacity>::append):
2815         (WTF::inlineCapacity>::prepend):
2816         (WTF::inlineCapacity>::removeFirst):
2817         (WTF::inlineCapacity>::removeLast):
2818         (WTF::inlineCapacity>::remove):
2819         (WTF::inlineCapacity>::after):
2820         (WTF::inlineCapacity>::before):
2821         * wtf/GetPtr.h:
2822         * wtf/HashTable.h:
2823         (WTF::HashTableBucketInitializer<false>::initialize):
2824         * wtf/HashTraits.h:
2825         (WTF::SimpleClassHashTraits::constructDeletedValue):
2826         (WTF::CustomHashTraits::constructDeletedValue):
2827         * wtf/ListHashSet.h:
2828         (WTF::ListHashSetConstIterator::get):
2829         * wtf/Vector.h:
2830         (WTF::Vector::swap):
2831         (WTF::OverflowHandler>::append):
2832         (WTF::OverflowHandler>::tryAppend):
2833         (WTF::OverflowHandler>::insert):
2834
2835 2015-01-24  Chris Dumez  <cdumez@apple.com>
2836
2837         Provide implementation for WTF::DefaultHash<bool>
2838         https://bugs.webkit.org/show_bug.cgi?id=140848
2839
2840         Reviewed by Anders Carlsson.
2841
2842         Provide implementation for WTF::DefaultHash<bool> so that we can use
2843         HashMap<std::pair<XXX, bool>> in the code base. Right now, we need to
2844         use some integer type to work around the issue.
2845
2846         * wtf/HashFunctions.h:
2847
2848 2015-01-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2849
2850         [GTK] Add missing null check in some derefGPtr implementations
2851         https://bugs.webkit.org/show_bug.cgi?id=140822
2852
2853         Reviewed by Sergio Villar Senin.
2854
2855         It's missing in GHashTable and GVariant implementations.
2856
2857         * wtf/gobject/GRefPtr.cpp:
2858         (WTF::derefGPtr):
2859
2860 2015-01-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2861
2862         [GTK] Add initial database process support
2863         https://bugs.webkit.org/show_bug.cgi?id=139491
2864
2865         Reviewed by Sergio Villar Senin.
2866
2867         Add support for using GRefPtr with GVariantBuilder.
2868
2869         * wtf/gobject/GRefPtr.cpp:
2870         (WTF::refGPtr):
2871         (WTF::derefGPtr):
2872         * wtf/gobject/GRefPtr.h:
2873         * wtf/gobject/GTypedefs.h:
2874
2875 2015-01-22  Ryosuke Niwa  <rniwa@webkit.org>
2876
2877         Add a build flag for ES6 class syntax
2878         https://bugs.webkit.org/show_bug.cgi?id=140760
2879
2880         Reviewed by Michael Saboff.
2881
2882         * wtf/FeatureDefines.h:
2883
2884 2015-01-21  Csaba Osztrogonác  <ossy@webkit.org>
2885
2886         Remove ENABLE(INSPECTOR) ifdef guards
2887         https://bugs.webkit.org/show_bug.cgi?id=140668
2888
2889         Reviewed by Darin Adler.
2890
2891         * wtf/FeatureDefines.h:
2892
2893 2015-01-20  YunQiang Su  <wzssyqa@gmail.com>
2894
2895         Fix failed to build for Linux/MIPS64EL
2896         https://bugs.webkit.org/show_bug.cgi?id=124370
2897
2898         Reviewed by Darin Adler.
2899
2900         Add MIPS64EL support.
2901
2902         * wtf/Platform.h:
2903         * wtf/dtoa/utils.h:
2904
2905 2015-01-19  Alexey Proskuryakov  <ap@apple.com>
2906
2907         Make ASan do bounds checks for WTF::Vector
2908         https://bugs.webkit.org/show_bug.cgi?id=140631
2909         rdar://problem/19437718
2910
2911         Reviewed by Darin Adler.
2912
2913         * wtf/SizeLimits.cpp: Disable Vector object size checks for ASan enabled builds.
2914
2915         * wtf/Vector.h:
2916         (WTF::VectorBuffer::endOfBuffer):
2917         (WTF::Vector::Vector):
2918         (WTF::Vector::~Vector):
2919         (WTF::Vector::swap):
2920         (WTF::OverflowHandler>::Vector):
2921         (WTF::=):
2922         (WTF::OverflowHandler>::fill):
2923         (WTF::OverflowHandler>::resize):
2924         (WTF::OverflowHandler>::shrink):
2925         (WTF::OverflowHandler>::grow):
2926         (WTF::OverflowHandler>::asanSetInitialBufferSizeTo):
2927         (WTF::OverflowHandler>::asanSetBufferSizeToFullCapacity):
2928         (WTF::OverflowHandler>::asanBufferSizeWillChangeTo):
2929         (WTF::OverflowHandler>::reserveCapacity):
2930         (WTF::OverflowHandler>::tryReserveCapacity):
2931         (WTF::OverflowHandler>::shrinkCapacity):
2932         (WTF::OverflowHandler>::append):
2933         (WTF::OverflowHandler>::tryAppend):
2934         (WTF::OverflowHandler>::appendSlowCase):
2935         (WTF::OverflowHandler>::uncheckedAppend):
2936         (WTF::OverflowHandler>::insert):
2937         (WTF::OverflowHandler>::remove):
2938         (WTF::OverflowHandler>::releaseBuffer):
2939
2940         * wtf/Compiler.h: Changed ASAN_ENABLED macro fallback value from false to 0,
2941         MSVC was not happy with false.
2942
2943 2015-01-20  Csaba Osztrogonác  <ossy@webkit.org>
2944
2945         Remove non-Windows cruft from WebKit/win/Plugins
2946         https://bugs.webkit.org/show_bug.cgi?id=140675
2947
2948         Reviewed by Anders Carlsson.
2949
2950         * wtf/FeatureDefines.h:
2951
2952 2015-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
2953
2954         WeakPtr functions crash when created with default constructor
2955         https://bugs.webkit.org/show_bug.cgi?id=140479
2956
2957         Reviewed by Andreas Kling.
2958
2959         This patch rearranges how WeakPtr works, and has the following ideas behind it:
2960
2961         1. WeakPtr should use Ref internally. This solves the crash by always having a
2962         valid WeakReference.
2963         2. Clients should not be able to construct WeakReferences directly. Instead,
2964         only WeakPtrFactory (and WeakPtr's default constructor) should be able to
2965         construct them. They are considered an implementation detail of WeakPtr.
2966         3. Except for the default constructor, clients should not be able to construct
2967         WeakPtrs directly. Instead, the WeakPtrFactory must construct them. This
2968         guarantees that the WeakPtrs all reference the same WeakReference.
2969         4. Clients can construct a WeakPtr using its default constructor, and then
2970         use the assignment operator to make it non-null. (Or they could use
2971         WeakPtrFactory to make it non-null at creation-time.)
2972         5. No one was using WeakReference::bindTo(), and it doesn't seem useful, so I
2973         removed it.
2974
2975         Tests: WTF_WeakPtr API tests
2976
2977         * wtf/Ref.h:
2978         (WTF::Ref::Ref): Added extra ASSERT()s, and explicitly deleted copy
2979         constructors with a comment.
2980         (WTF::Ref::operator=): Added extra ASSERT()s, and explicitly deleted copy
2981         assignment operators with a comment.
2982         * wtf/WeakPtr.h:
2983         (WTF::WeakReference::clear): Used nullptr.
2984         (WTF::WeakReference::create): Moved to private:
2985         (WTF::WeakPtr::WeakPtr): For the default constructor, initialized the Ref with
2986         a new WeakReference. For the other constructor, moved it to private:. Also added
2987         copy constructors and copy assignment operators (since Ref doesn't have them but
2988         RefPtr does). These constructors/operators are relied upon in various places
2989         throughout WebCore.
2990         (WTF::WeakPtr::operator bool): Made non-explicit.
2991         (WTF::WeakReference::createUnbound): Deleted.
2992         (WTF::WeakReference::bindTo): Deleted.
2993         (WTF::WeakReference::WeakReference): Deleted.
2994         (WTF::WeakPtrFactory::WeakPtrFactory): Deleted.
2995
2996 2015-01-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2997
2998         std::all_of requires complete C++ iterators in GCC 4.8
2999         https://bugs.webkit.org/show_bug.cgi?id=140530
3000
3001         Reviewed by Darin Adler.
3002
3003         In the WebKit2/UIProcess/WebProcessLifetimeObserver.cpp, std::all_of
3004         is used for HashIterators. However, std::all_of requires the complete
3005         C++ iterator interface including iterator_category typedef member and
3006         it raises compile error in GCC 4.8 (and libstdc++) environment.
3007
3008         This patch inherits std::iterator with appropriate type parameters.
3009         It automatically defines required typedefs including iterator_category.
3010
3011         * wtf/HashIterators.h:
3012
3013 2015-01-15  Csaba Osztrogonác  <ossy@webkit.org>
3014
3015         Remove ENABLE(SQL_DATABASE) guards
3016         https://bugs.webkit.org/show_bug.cgi?id=140434
3017
3018         Reviewed by Darin Adler.
3019
3020         * wtf/FeatureDefines.h:
3021
3022 2015-01-14  Csaba Osztrogonác  <ossy@webkit.org>
3023
3024         Unreviewed fix after r163330.
3025
3026         * wtf/Platform.h: Use C style comment.
3027
3028 2015-01-14  Marc Juul  <juul@sudomesh.org>
3029
3030         C++ style comment was preventing compile if CPU(ARM_NEON)
3031         https://bugs.webkit.org/show_bug.cgi?id=133827
3032
3033         Reviewed by Csaba Osztrogonác.
3034
3035         * wtf/Platform.h:
3036
3037 2015-01-13  Chris Dumez  <cdumez@apple.com>
3038
3039         Make WTF::Optional work with msvc 2013
3040         https://bugs.webkit.org/show_bug.cgi?id=140401
3041
3042         Reviewed by Anders Carlsson.
3043
3044         Update the WTF::Optional implementation to use std::aligned_memory and
3045         placement new instead of an unrestricted union because msvc 2013 still
3046         doesn't support unrestricted unions.
3047
3048         This change is a pre-requirement to fix Bug 140347 as this change uses
3049         WTF::Optional with types that have non-trivial copy constructors.
3050
3051         This change is covered by the existing Optional WTF test.
3052
3053         * wtf/Optional.h:
3054
3055 2015-01-11  Sam Weinig  <sam@webkit.org>
3056
3057         Remove support for SharedWorkers
3058         https://bugs.webkit.org/show_bug.cgi?id=140344
3059
3060         Reviewed by Anders Carlsson.
3061
3062         * wtf/FeatureDefines.h:
3063
3064 2015-01-12  Darin Adler  <darin@apple.com>
3065
3066         Modernize and streamline HTMLTokenizer
3067         https://bugs.webkit.org/show_bug.cgi?id=140166
3068
3069         Reviewed by Sam Weinig.
3070
3071         * wtf/Forward.h: Removed PassRef, added OrdinalNumber and TextPosition.
3072
3073 2015-01-09  Commit Queue  <commit-queue@webkit.org>
3074
3075         Unreviewed, rolling out r178154, r178163, and r178164.
3076         https://bugs.webkit.org/show_bug.cgi?id=140292
3077
3078         Still multiple assertion failures on tests (Requested by ap on
3079         #webkit).
3080
3081         Reverted changesets:
3082
3083         "Modernize and streamline HTMLTokenizer"
3084         https://bugs.webkit.org/show_bug.cgi?id=140166
3085         http://trac.webkit.org/changeset/178154
3086
3087         "Unreviewed speculative buildfix after r178154."
3088         http://trac.webkit.org/changeset/178163
3089
3090         "One more unreviewed speculative buildfix after r178154."
3091         http://trac.webkit.org/changeset/178164
3092
3093 2015-01-08  Darin Adler  <darin@apple.com>
3094
3095         Modernize and streamline HTMLTokenizer
3096         https://bugs.webkit.org/show_bug.cgi?id=140166
3097
3098         Reviewed by Sam Weinig.
3099
3100         * wtf/Forward.h: Removed PassRef, added OrdinalNumber and TextPosition.
3101
3102 2015-01-08  Benjamin Poulain  <benjamin@webkit.org>
3103
3104         [WK2] Start a prototype for declarative site specific extensions
3105         https://bugs.webkit.org/show_bug.cgi?id=140160
3106
3107         Reviewed by Andreas Kling.
3108
3109         * wtf/FeatureDefines.h:
3110
3111 2015-01-07  Daniel Bates  <dabates@apple.com>
3112
3113         [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT
3114         https://bugs.webkit.org/show_bug.cgi?id=137371
3115
3116         As pointed out by Tim Horton, use C-style comment instead of C++-style comment as
3117         wtf/Compiler.h is included in the sandbox profile and the sandbox profile compiler
3118         doesn't understand C++-style comments.
3119
3120         * wtf/Compiler.h:
3121
3122 2015-01-07  Daniel Bates  <dabates@apple.com>
3123
3124         [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT
3125         https://bugs.webkit.org/show_bug.cgi?id=137371
3126
3127         Reviewed by David Kilzer.
3128
3129         Move EXTERN_C_BEGIN and EXTERN_C_END macros from file WebKit2/config.h to here and
3130         rename them to WTF_EXTERN_C_BEGIN and WTF_EXTERN_C_END, respectively, so that we
3131         can make use of these macros in SPI wrapper headers (e.g. UIKitSPI.h).
3132
3133         I'll look to transition existing code to WTF_EXTERN_C_BEGIN/WTF_EXTERN_C_END and
3134         remove EXTERN_C in a subsequent commit(s).
3135
3136         * wtf/Compiler.h:
3137
3138 2015-01-07  Commit Queue  <commit-queue@webkit.org>
3139
3140         Unreviewed, rolling out r178068.
3141         https://bugs.webkit.org/show_bug.cgi?id=140235
3142
3143         Breaks the iOS build (Requested by enrica on #webkit).
3144
3145         Reverted changeset:
3146
3147         "[iOS] Make WebKit2 build with public iOS SDK and more build
3148         fixes for DRT"
3149         https://bugs.webkit.org/show_bug.cgi?id=137371
3150         http://trac.webkit.org/changeset/178068
3151
3152 2015-01-07  Daniel Bates  <dabates@apple.com>
3153
3154         [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT
3155         https://bugs.webkit.org/show_bug.cgi?id=137371
3156
3157         Reviewed by David Kilzer.
3158
3159         Move EXTERN_C_BEGIN and EXTERN_C_END macros from file WebKit2/config.h to here and
3160         rename them to WTF_EXTERN_C_BEGIN and WTF_EXTERN_C_END, respectively, so that we
3161         can make use of these macros in SPI wrapper headers (e.g. UIKitSPI.h).
3162
3163         I'll look to transition existing code to WTF_EXTERN_C_BEGIN/WTF_EXTERN_C_END and
3164         remove EXTERN_C in a subsequent commit(s).
3165
3166         * wtf/Compiler.h:
3167
3168 2015-01-07  Brian J. Burg  <burg@cs.washington.edu>
3169
3170         Web Inspector: purge PassRefPtr from Inspector code and use Ref for typed and untyped protocol objects
3171         https://bugs.webkit.org/show_bug.cgi?id=140053
3172
3173         Reviewed by Andreas Kling.
3174
3175         * wtf/Stopwatch.h:
3176         (WTF::Stopwatch::create): Return a Ref.
3177
3178 2015-01-07  Commit Queue  <commit-queue@webkit.org>
3179
3180         Unreviewed, rolling out r178039.
3181         https://bugs.webkit.org/show_bug.cgi?id=140187
3182
3183         Breaks ObjC Inspector Protocol (Requested by JoePeck on
3184         #webkit).
3185
3186         Reverted changeset:
3187
3188         "Web Inspector: purge PassRefPtr from Inspector code and use
3189         Ref for typed and untyped protocol objects"
3190         https://bugs.webkit.org/show_bug.cgi?id=140053
3191         http://trac.webkit.org/changeset/178039
3192
3193 2015-01-06  Brian J. Burg  <burg@cs.washington.edu>
3194
3195         Web Inspector: purge PassRefPtr from Inspector code and use Ref for typed and untyped protocol objects
3196         https://bugs.webkit.org/show_bug.cgi?id=140053
3197
3198         Reviewed by Andreas Kling.
3199
3200         * wtf/Stopwatch.h:
3201         (WTF::Stopwatch::create): Return a Ref.
3202
3203 2015-01-06  Alexey Proskuryakov  <ap@apple.com>
3204
3205         ADDRESS_SANITIZER macro is overloaded
3206         https://bugs.webkit.org/show_bug.cgi?id=140130
3207
3208         Reviewed by Anders Carlsson.
3209
3210         * wtf/Compiler.h: Added an ASAN_ENABLED macro. The abbreviation should become well
3211         known - we already use it in tools.
3212
3213         * wtf/Assertions.h:
3214         * wtf/RefCounted.h:
3215         * wtf/SizeLimits.cpp:
3216         Change the conditional to ENABLE(SECURITY_ASSERTIONS). These checks will be used
3217         in debug builds, and also when one explicitly passes -DENABLE_SECURITY_ASSERTIONS.
3218
3219 2015-01-05  Andreas Kling  <akling@apple.com>
3220
3221         Purge PassRefPtr from Page.
3222         <https://webkit.org/b/140089>
3223
3224         Reviewed by Anders Carlsson.
3225
3226         Make SchedulePair::create() return Ref since it never fails.
3227
3228         * wtf/SchedulePair.h:
3229         (WTF::SchedulePair::create):
3230
3231 2015-01-01  Darin Adler  <darin@apple.com>
3232
3233         Rework code that hides characters in password fields to streamline a little
3234         https://bugs.webkit.org/show_bug.cgi?id=140035
3235
3236         Reviewed by Sam Weinig.
3237
3238         * wtf/text/StringImpl.cpp:
3239         (WTF::StringImpl::fill): Deleted.
3240         * wtf/text/StringImpl.h: Deleted StringImpl::fill.
3241         * wtf/text/WTFString.h:
3242         (WTF::String::fill): Deleted.
3243
3244 2014-12-26  Dan Bernstein  <mitz@apple.com>
3245
3246         Build fix.
3247
3248         Removed use of __builtin_s{add,sub}_overflow introduced in r177729 that was causing a compiler used at Apple to crash because of <rdar://problem/19347133>.
3249
3250         * wtf/SaturatedArithmetic.h:
3251         (signedAddOverflows):
3252         (signedSubtractOverflows):
3253
3254 2014-12-26  Dan Bernstein  <mitz@apple.com>
3255
3256         <rdar://problem/19348208> REGRESSION (r177027): iOS builds use the wrong toolchain
3257         https://bugs.webkit.org/show_bug.cgi?id=139950
3258
3259         Reviewed by David Kilzer.
3260
3261         * Configurations/Base.xcconfig: Only define TOOLCHAINS when building for OS X, doing so
3262         in a manner that works with Xcode 5.1.1.
3263
3264 2014-12-25  Dan Bernstein  <mitz@apple.com>
3265
3266         Try to fix the Windows build after r177733.
3267
3268         * wtf/Ref.h:
3269
3270 2014-12-25  Alexey Proskuryakov  <ap@apple.com>
3271
3272         Simplify saturated integer add/sub
3273         https://bugs.webkit.org/show_bug.cgi?id=139854
3274
3275         Address Darin's post-commit feedback to fix API tests.
3276
3277         * wtf/SaturatedArithmetic.h: (saturatedSubtraction):
3278
3279 2014-12-24  Benjamin Poulain  <benjamin@webkit.org>
3280
3281         Simplify saturated integer add/sub
3282         https://bugs.webkit.org/show_bug.cgi?id=139854
3283
3284         Reviewed by Darin Adler.
3285
3286         * wtf/Compiler.h:
3287         Make a wrapper for __has_builtin for compilers that do not support it.
3288
3289         * wtf/SaturatedArithmetic.h:
3290         (saturatedAddition):
3291         (saturatedSubtraction):
3292         Use the builtins when possible instead of reinventing the wheel.
3293         On ARMv7, use the saturated math instructions.
3294
3295 2014-12-23  Anders Carlsson  <andersca@apple.com>
3296
3297         Move dynamic_objc_cast to RetainPtr.h
3298         https://bugs.webkit.org/show_bug.cgi?id=139915
3299
3300         Reviewed by Sam Weinig.
3301
3302         * wtf/RetainPtr.h:
3303         (WTF::dynamic_objc_cast):
3304
3305 2014-12-23  Anders Carlsson  <andersca@apple.com>
3306
3307         Re-indent RefPtr.h and RetainPtr.h.
3308
3309         Rubber-stamped by Sam Weinig.
3310
3311         * wtf/RefPtr.h:
3312         * wtf/RetainPtr.h:
3313
3314 2014-12-20  Eric Carlson  <eric.carlson@apple.com>
3315
3316         [iOS] add optimized fullscreen API
3317         https://bugs.webkit.org/show_bug.cgi?id=139833
3318         <rdar://problem/18844486>
3319
3320         Reviewed by Simon Fraser.
3321
3322         * wtf/Platform.h: Define ENABLE_VIDEO_PRESENTATION_MODE.
3323
3324 2014-12-18  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
3325
3326         Fix build break on EFL and GTK since r177523
3327         https://bugs.webkit.org/show_bug.cgi?id=139805
3328
3329         Reviewed by Csaba Osztrogonác.
3330
3331         * wtf/Ref.h: Include <wtf/StdLibExtras.h> to use std::exchange().
3332
3333 2014-12-18  Gavin Barraclough  <barraclough@apple.com>
3334
3335         Add strong typing to RefCounter interface, return value as a bool.
3336         https://bugs.webkit.org/show_bug.cgi?id=139776
3337
3338         Unreviewed style fixes.
3339
3340         * wtf/RefCounter.h:
3341         (WTF::=):
3342
3343 2014-12-18  Brent Fulgham  <bfulgham@apple.com>
3344
3345         [Win] Build correction after r177541.
3346
3347         * wtf/RefCounter.h:
3348         (WTF::RefCounter::Token<T>::Token): Revise constructor inlines to correct
3349         syntax error.
3350
3351 2014-12-18  Gavin Barraclough  <barraclough@apple.com>
3352
3353         Add strong typing to RefCounter interface, return value as a bool.
3354         https://bugs.webkit.org/show_bug.cgi?id=139776
3355
3356         Reviewed by Geoff Garen.
3357
3358         Currently all token vended by a RefCounter have the same type - Ref<RefCounter::Count>.
3359         This means there is no compile time type checking to prevent mistakes. Update the count()
3360         method to token<>(), templated on type used to identify the token being returned.
3361         Calls to token<T>() will return a result of type RefCounter::Token<T>.
3362
3363         There are a few problems with the fact the counter will return you an exact count of the
3364         number of outstanding tokens:
3365           - It is desirable to only fire the callback on zero-edge changes; it is more consistent
3366             to do so if the value is only readable as a boolean.
3367           - It is desirable to provide the value as an argument to the callback, however to make
3368             this useful for integer values it is also necessary to indicate the direction of change
3369             (0->1 is often interesting where 2->1 is not).
3370           - There is a mismatch between the precision of returning a count, and the inherent
3371             imprecision of a token based mechanism, where it may be difficult to guarantee
3372             absolutely no unnecessary refcount churn, and thus unintentional counter values.
3373
3374         * wtf/RefCounter.cpp:
3375         (WTF::RefCounter::Count::ref):
3376         (WTF::RefCounter::Count::deref):
3377             - only call the callback on zero-edge changes; provide the value.
3378         (WTF::RefCounter::RefCounter):
3379             - callback now takes a bool argument.
3380         * wtf/RefCounter.h:
3381         (WTF::RefCounter::Token::Token):
3382             - New opaque type to reference the RefCounter::Count.
3383         (WTF::RefCounter::Token::operator!):
3384             - ! operator checks for null / anasigned Tokens.
3385         (WTF::RefCounter::RefCounter):
3386             - callback now takes a bool argument.
3387         (WTF::RefCounter::token):
3388             - renamed from count(), templated on type of token returned.
3389         (WTF::RefCounter::value):
3390             - now returns a bool.
3391         (WTF::RefCounter::Token<T>::Token):
3392         (WTF::=):
3393             - Tokens can be copied & assigned.
3394         (WTF::RefCounter::count): Deleted.
3395             - renamed to token<>().
3396
3397 2014-12-18  Anders Carlsson  <andersca@apple.com>
3398
3399         Simplify smart pointer classes by using std::exchange
3400         https://bugs.webkit.org/show_bug.cgi?id=139790
3401
3402         Reviewed by Andreas Kling.
3403
3404         * wtf/MallocPtr.h:
3405         * wtf/OSObjectPtr.h:
3406         * wtf/OwnPtr.h:
3407         (WTF::OwnPtr<T>::clear):
3408         (WTF::OwnPtr<T>::release):
3409         (WTF::OwnPtr<T>::leakPtr):
3410         (WTF::=):
3411         * wtf/PassOwnPtr.h:
3412         (WTF::PassOwnPtr<T>::leakPtr):
3413         * wtf/PassRefPtr.h:
3414         (WTF::PassRefPtr<T>::leakRef):
3415         * wtf/Ref.h:
3416         * wtf/RefPtr.h:
3417         (WTF::RefPtr<T>::clear):
3418         (WTF::RefPtr<T>::leakRef):
3419         * wtf/RetainPtr.h:
3420         (WTF::RetainPtr<T>::leakRef):
3421
3422 2014-12-18  Anders Carlsson  <andersca@apple.com>
3423
3424         Clean up MachSendRight and add a copySendRight member function
3425         https://bugs.webkit.org/show_bug.cgi?id=139788
3426
3427         Reviewed by Tim Horton.
3428
3429         * wtf/StdLibExtras.h:
3430         (std::exchange):
3431         Add an implementation of std::exchange.
3432
3433 2014-12-17  Chris Dumez  <cdumez@apple.com>
3434
3435         [iOS] Make it possible to toggle FeatureCounter support at runtime
3436         https://bugs.webkit.org/show_bug.cgi?id=139688
3437         <rdar://problem/19266254>
3438
3439         Reviewed by Andreas Kling.
3440
3441         Remove FeatureCounter API from WTF and move it to WebCore/platform
3442         instead so that it can log conditionally based on a WebCore setting.
3443
3444         * WTF.vcxproj/WTF.vcxproj:
3445         * WTF.xcodeproj/project.pbxproj:
3446         * wtf/CMakeLists.txt:
3447
3448 2014-12-17  Brent Fulgham  <bfulgham@apple.com>
3449
3450         [Win] Correct DebugSuffix builds under MSBuild
3451         https://bugs.webkit.org/show_bug.cgi?id=139733
3452         <rdar://problem/19276880>
3453
3454         Reviewed by Simon Fraser.
3455
3456         * WTF.vcxproj/WTF.proj: Make sure to use the '_debug' suffix
3457         when building the DebugSuffix target.
3458
3459 2014-12-17  Anders Carlsson  <andersca@apple.com>
3460
3461         Make Ref::copyRef const and ref-qualified
3462         https://bugs.webkit.org/show_bug.cgi?id=139730
3463
3464         Reviewed by Andreas Kling.
3465
3466         * wtf/Ref.h:
3467
3468 2014-12-16  Daniel Bates  <dabates@apple.com>
3469
3470         [iOS] WTF fails to build with public SDK due to missing header CPAggregateDictionary.h
3471         https://bugs.webkit.org/show_bug.cgi?id=139695
3472
3473         Reviewed by Chris Dumez.
3474
3475         Add USE(APPLE_INTERNAL_SDK)-guard around iOS-specific feature counter implementation
3476         as we are only interested in counting features in builds of iOS WebKit that were built
3477         with the Apple Internal SDK.
3478
3479         * wtf/FeatureCounter.cpp:
3480         * wtf/ios/FeatureCounter.mm:
3481
3482 2014-12-16  Geoffrey Garen  <ggaren@apple.com>
3483
3484         Enable FastMalloc in debug builds
3485         https://bugs.webkit.org/show_bug.cgi?id=139692
3486
3487         Reviewed by Alexey Proskuryakov.
3488
3489         This will give debug builds greater fidelity to the real thing.
3490
3491         FastMalloc now transparently supports all the malloc debugging APIs I
3492         know of by disabling itself at runtime -- and it should be easy to add
3493         support for any APIs I missed -- so there's no need to turn it off in
3494         debug builds.
3495
3496         * wtf/FastMalloc.cpp:
3497
3498 2014-12-16  Anders Carlsson  <andersca@apple.com>
3499
3500         RefPtr::copyRef should be const
3501         https://bugs.webkit.org/show_bug.cgi?id=139689
3502
3503         Reviewed by Andreas Kling.
3504
3505         copyRef() doesn't modify the original object so it should be const.
3506         Also, add a && qualified overload and mark it deleted so that calls to copyRef() where
3507         the object is an rvalue will fail to compile.
3508
3509         * wtf/RefPtr.h:
3510
3511 2014-12-15  Chris Dumez  <cdumez@apple.com>
3512
3513         [iOS] Add feature counting support
3514         https://bugs.webkit.org/show_bug.cgi?id=139652
3515         <rdar://problem/19255690>
3516
3517         Reviewed by Gavin Barraclough.
3518
3519         Add a FeatureCounter API for to log / count when a feature
3520         is used. For now, this is only implementated on iOS.
3521
3522         * WTF.vcxproj/WTF.vcxproj:
3523         * WTF.xcodeproj/project.pbxproj:
3524         * wtf/CMakeLists.txt:
3525         * wtf/FeatureCounter.cpp: Added.
3526         (WTF::incrementFeatureCounterKey):
3527         (WTF::setFeatureCounterKey):
3528         * wtf/FeatureCounter.h: Added.
3529         * wtf/ios/FeatureCounter.mm: Added.
3530         (WTF::incrementFeatureCounterKey):
3531         (WTF::setFeatureCounterKey):
3532
3533 2014-12-12  Anders Carlsson  <andersca@apple.com>
3534
3535         Get rid of the DONT_FINALIZE_ON_MAIN_THREAD #define
3536         https://bugs.webkit.org/show_bug.cgi?id=139613
3537
3538         Reviewed by Sam Weinig.
3539
3540         * wtf/Platform.h:
3541         Remove the #define.
3542
3543 2014-12-15  Commit Queue  <commit-queue@webkit.org>
3544
3545         Unreviewed, rolling out r177284.
3546         https://bugs.webkit.org/show_bug.cgi?id=139658
3547
3548         "Breaks API tests and LayoutTests on Yosemite Debug"
3549         (Requested by msaboff on #webkit).
3550
3551         Reverted changeset:
3552
3553         "Make sure range based iteration of Vector<> still receives
3554         bounds checking"
3555         https://bugs.webkit.org/show_bug.cgi?id=138821
3556         http://trac.webkit.org/changeset/177284
3557
3558 2014-12-15  Andreas Kling  <akling@apple.com>
3559
3560         Purge PassRefPtr from FocusEvent code.
3561         <https://webkit.org/b/139647>
3562
3563         Reviewed by Anders Carlsson.
3564
3565         Add a RefPtr::copyRef() to use when passing a RefPtr to a RefPtr&& without
3566         transferring the ownership.
3567
3568         * wtf/RefPtr.h:
3569
3570 2014-12-15  Oliver Hunt  <oliver@apple.com>
3571
3572         Make sure range based iteration of Vector<> still receives bounds checking
3573         https://bugs.webkit.org/show_bug.cgi?id=138821
3574
3575         Reviewed by Mark Lam.
3576
3577         Add a new IndexedIterator struct to WTF that wraps a
3578         Vector type and index to provide pointer like semantics
3579         while still performing runtime bounds checking, even in
3580         release builds. We store a simple index into the vector
3581         which means that this iterator allows vector resizing
3582         during iteration. If the vector is resized such that the
3583         iterator is out of bounds, then any attempt to dereference
3584         the iterator will crash safely.
3585
3586         For the purpose of retaining semantically equivalent
3587         behaviour, the iterator can be moved to m_index == size()
3588         as that is the standard "end" terminator for these types.
3589         Attempting to dereference at that point will still crash
3590         rather than perform an unsafe memory operation.
3591
3592         By necessity there are many overrides for operator + and - as
3593         we otherwise hit many different type promotion ambiguities when
3594         performing arithmetic with iterators. These ambiguities are also
3595         different for 32- vs. 64-bit, so duplicating the functions
3596         and then forwarding to the core implementations that performed
3597         the bounds checking and mutation seemed like the right call.
3598
3599         * WTF.vcxproj/WTF.vcxproj:
3600         * WTF.vcxproj/WTF.vcxproj.filters:
3601         * WTF.xcodeproj/project.pbxproj:
3602         * wtf/IndexedIterator.h: Added.
3603         (WTF::IndexedIterator::IndexedIterator):
3604         (WTF::IndexedIterator::operator->):
3605         (WTF::IndexedIterator::operator*):
3606         (WTF::IndexedIterator::get):
3607         (WTF::IndexedIterator::operator++):
3608         (WTF::IndexedIterator::operator--):
3609         (WTF::IndexedIterator::operator UnspecifiedBoolType):
3610         (WTF::IndexedIterator::operator-):
3611         (WTF::IndexedIterator::operator=):
3612         (WTF::IndexedIterator::operator==):
3613         (WTF::IndexedIterator::operator!=):
3614         (WTF::IndexedIterator::operator<):
3615         (WTF::IndexedIterator::operator<=):
3616         (WTF::IndexedIterator::operator>):
3617         (WTF::IndexedIterator::operator>=):
3618         (WTF::IndexedIterator::operator const_iterator):
3619         (WTF::IndexedIterator::unsafeGet):
3620         (WTF::getPtr):
3621         (WTF::operator-):
3622         (WTF::operator==):
3623         (WTF::operator!=):
3624         (WTF::operator<=):
3625         (WTF::operator>=):
3626         (WTF::operator<):
3627         (WTF::operator>):
3628         (WTF::IndexedIteratorSelector::makeIterator):
3629         (WTF::IndexedIteratorSelector::makeConstIterator):
3630         * wtf/RefCountedArray.h:
3631         (WTF::RefCountedArray::RefCountedArray):
3632         * wtf/Vector.h:
3633         (WTF::Vector::Vector):
3634         (WTF::Vector::begin):
3635         (WTF::Vector::end):
3636         (WTF::OverflowHandler>::Vector):
3637         (WTF::=):
3638         (WTF::OverflowHandler>::fill):
3639         (WTF::OverflowHandler>::expandCapacity):
3640         (WTF::OverflowHandler>::tryExpandCapacity):
3641         (WTF::OverflowHandler>::resize):
3642         (WTF::OverflowHandler>::shrink):
3643         (WTF::OverflowHandler>::grow):
3644         (WTF::OverflowHandler>::reserveCapacity):
3645         (WTF::OverflowHandler>::tryReserveCapacity):
3646         (WTF::OverflowHandler>::shrinkCapacity):
3647         (WTF::OverflowHandler>::append):
3648         (WTF::OverflowHandler>::tryAppend):
3649         (WTF::OverflowHandler>::appendSlowCase):
3650         (WTF::OverflowHandler>::uncheckedAppend):
3651         (WTF::OverflowHandler>::appendVector):
3652         (WTF::OverflowHandler>::insert):
3653         (WTF::OverflowHandler>::insertVector):
3654         (WTF::OverflowHandler>::remove):
3655
3656 2014-12-14  Andreas Kling  <akling@apple.com>
3657
3658         Minor follow-up tweaks suggested by Darin on bug 139587.
3659
3660         * wtf/text/WTFString.h:
3661         (WTF::String::String):
3662
3663 2014-12-14  Andreas Kling  <akling@apple.com>
3664
3665         Replace PassRef with Ref/Ref&& across the board.
3666         <https://webkit.org/b/139587>
3667
3668         Reviewed by Darin Adler.
3669
3670         Kill the PassRef class and replace it by Ref/Ref&&.
3671         Usage is simple:
3672
3673             - For locals and members, keep using Ref<T>.
3674             - For return types, use Ref<T>.
3675             - For (ownership-transferring) arguments, use Ref<T>&&.
3676
3677         When passing to a Ref&&, use WTF::move() to mobilize the value
3678         at the call site, e.g:
3679
3680             void myFunction(Ref<Foo>&&);
3681
3682             Ref<Foo> myFoo(Foo::create());
3683             myFunction(WTF::move(myFoo));
3684             // 'myFoo' is invalid from this point forward.
3685
3686         As you can see, it works a lot like PassRefPtr, but unlike PassRefPtr
3687         it won't surprise you by becoming null *unless* you WTF::move it.
3688
3689         I've also added a Ref::copyRef() for instances where you want to
3690         return a Ref *without* transferring ownership, e.g code like:
3691
3692             Ref<Foo> foo() { return m_foo; }
3693
3694         ... now becomes ...
3695
3696             Ref<Foo> foo() { return m_foo.copyRef(); }
3697
3698         This makes it explicit that a refcount bump will occur.
3699
3700         Finally, do note that unlike last year's PassRef, Ref&& does not
3701         require you to move it to avoid leaking; it will clean itself up.
3702
3703         * wtf/PassRef.h:
3704         (WTF::adopted): Deleted.
3705         (WTF::PassRef<T>::PassRef): Deleted.
3706         (WTF::PassRef<T>::~PassRef): Deleted.
3707         (WTF::PassRef<T>::get): Deleted.
3708         (WTF::PassRef<T>::ptr): Deleted.
3709         (WTF::PassRef<T>::leakRef): Deleted.
3710         (WTF::adoptRef): Deleted.
3711         (WTF::createRefCounted): Deleted.
3712         * wtf/PassRefPtr.h:
3713         (WTF::PassRefPtr::PassRefPtr):
3714         * wtf/Ref.h:
3715         (WTF::adopted):
3716         (WTF::Ref::~Ref):
3717         (WTF::Ref::Ref):
3718         (WTF::Ref::operator=):
3719         (WTF::Ref::operator->):
3720         (WTF::Ref::ptr):
3721         (WTF::Ref::get):
3722         (WTF::Ref::operator T&):
3723         (WTF::Ref::operator const T&):
3724         (WTF::Ref<T>::replace):
3725         (WTF::adoptRef):
3726         * wtf/RefCounter.h:
3727         (WTF::RefCounter::count):
3728         * wtf/RefPtr.h:
3729         (WTF::RefPtr::releaseNonNull):
3730         (WTF::RefPtr<T>::RefPtr):
3731         (WTF::=):
3732         * wtf/text/AtomicString.cpp:
3733         (WTF::addToStringTable):
3734         (WTF::AtomicString::add):
3735         (WTF::AtomicString::addFromLiteralData):
3736         (WTF::AtomicString::addSlowCase):
3737         * wtf/text/AtomicString.h:
3738         * wtf/text/StringImpl.cpp:
3739         (WTF::StringImpl::createFromLiteral):
3740         (WTF::StringImpl::createWithoutCopying):
3741         (WTF::StringImpl::createUninitializedInternal):
3742         (WTF::StringImpl::createUninitializedInternalNonEmpty):
3743         (WTF::StringImpl::createUninitialized):
3744         (WTF::StringImpl::reallocateInternal):
3745         (WTF::StringImpl::reallocate):
3746         (WTF::StringImpl::createInternal):
3747         (WTF::StringImpl::create):
3748         (WTF::StringImpl::create8BitIfPossible):
3749         (WTF::StringImpl::substring):
3750         (WTF::StringImpl::lower):
3751         (WTF::StringImpl::upper):
3752         (WTF::StringImpl::fill):
3753         (WTF::StringImpl::foldCase):
3754         (WTF::StringImpl::convertToASCIILowercase):
3755         (WTF::StringImpl::stripMatchedCharacters):
3756         (WTF::StringImpl::stripWhiteSpace):
3757         (WTF::StringImpl::removeCharacters):
3758         (WTF::StringImpl::simplifyMatchedCharactersToSpace):
3759         (WTF::StringImpl::simplifyWhiteSpace):
3760         (WTF::StringImpl::replace):
3761         (WTF::StringImpl::adopt):
3762         * wtf/text/StringImpl.h:
3763         (WTF::StringImpl::create8BitIfPossible):
3764         (WTF::StringImpl::create):
3765         (WTF::StringImpl::createSubstringSharingImpl8):
3766         (WTF::StringImpl::createSubstringSharingImpl):
3767         (WTF::StringImpl::createFromLiteral):
3768         (WTF::StringImpl::createEmptyUnique):
3769         (WTF::StringImpl::adopt):
3770         (WTF::StringImpl::replace):
3771         (WTF::StringImpl::constructInternal<LChar>):
3772         (WTF::StringImpl::constructInternal<UChar>):
3773         (WTF::StringImpl::isolatedCopy):
3774         * wtf/text/WTFString.h:
3775         (WTF::String::String):
3776
3777 2014-12-10  Geoffrey Garen  <ggaren@apple.com>
3778
3779         Please disable the webkitFirstVersionWithInitConstructorSupport check on Apple TV
3780         https://bugs.webkit.org/show_bug.cgi?id=139501
3781
3782         Reviewed by Gavin Barraclough.
3783
3784         Added a platform definition for APPLETV.
3785
3786         (It's not an OS because it's not mutually exclusive with other OS definitions.)
3787
3788         * wtf/Platform.h:
3789
3790 2014-12-10  Martin Robinson  <mrobinson@igalia.com>
3791
3792         [GTK] Add support for text-decoration-skip
3793         https://bugs.webkit.org/show_bug.cgi?id=131540
3794
3795         Reviewed by Gustavo Noronha Silva.
3796
3797         * wtf/Platform.h: Enable text decoration skip by default.
3798
3799 2014-12-09  David Kilzer  <ddkilzer@apple.com>
3800
3801         Switch from using PLATFORM_NAME to SDK selectors in ANGLE, bmalloc, gtest, JavaScriptCore, WTF
3802         <http://webkit.org/b/139212>
3803
3804         Reviewed by Joseph Pecoraro.
3805
3806         * Configurations/Base.xcconfig:
3807         - Only set GCC_ENABLE_OBJC_GC, GCC_MODEL_TUNING and TOOLCHAINS
3808           on OS X.
3809         * Configurations/DebugRelease.xcconfig:
3810         - Only set MACOSX_DEPLOYMENT_TARGET and SDKROOT on OS X.
3811
3812 2014-12-09  Dean Jackson  <dino@apple.com>
3813
3814         [Apple] Use Accelerate framework to speed-up FEGaussianBlur
3815         https://bugs.webkit.org/show_bug.cgi?id=139310
3816
3817         Unreviewed followup, after comments by Andreas Kling.
3818
3819         It was pointed out that we already have a USE(ACCELERATE), so
3820         we don't need a HAVE(ACCELERATE) :)
3821
3822         * wtf/Platform.h:
3823
3824 2014-12-09  Alberto Garcia  <berto@igalia.com>
3825
3826         Undefined Symbol build error "_objc_registerThreadWithCollector" when building WebKit GTK Mac OS X on Snow Leopard
3827         https://bugs.webkit.org/show_bug.cgi?id=58737
3828
3829         Reviewed by Darin Adler.
3830
3831         Replace OS(MAC_OS_X) with PLATFORM(MAC) to prevent using
3832         osx-specific code in WebKitGTK+ builds.
3833
3834         * wtf/ThreadingPthreads.cpp:
3835         (WTF::initializeCurrentThreadInternal):
3836
3837 2014-12-08  Dean Jackson  <dino@apple.com>
3838
3839         [Apple] Use Accelerate framework to speed-up FEGaussianBlur
3840         https://bugs.webkit.org/show_bug.cgi?id=139310
3841         <rdar://problem/18434594>
3842
3843         Reviewed by Simon Fraser.
3844
3845         Add a HAVE_ACCELERATE flag, true on Apple platforms.
3846
3847         * wtf/Platform.h:
3848
3849 2014-12-08  Myles C. Maxfield  <mmaxfield@apple.com>
3850
3851         Fix iOS build after r176971.
3852
3853         I had previously modified the WTF forwarding header instead of modifying the real source.
3854
3855         * wtf/unicode/CharacterNames.h:
3856
3857 2014-12-08  Anders Carlsson  <andersca@apple.com>
3858
3859         Change WTF::currentCPUTime to return std::chrono::microseconds and get rid of currentCPUTimeMS
3860         https://bugs.webkit.org/show_bug.cgi?id=139410
3861
3862         Reviewed by Andreas Kling.
3863
3864         * wtf/CurrentTime.cpp:
3865         (WTF::currentCPUTime):
3866         (WTF::currentCPUTimeMS): Deleted.
3867         * wtf/CurrentTime.h:
3868
3869 2014-12-08  Chris Dumez  <cdumez@apple.com>
3870
3871         Revert r176293 & r176275
3872
3873         Unreviewed, revert r176293 & r176275 changing the Vector API to use unsigned type
3874         instead of size_t. There is some disagreement regarding the long-term direction
3875         of the API and we shouldn’t leave the API partly transitioned to unsigned type
3876         while making a decision.
3877
3878         * wtf/Forward.h:
3879         * wtf/Vector.h:
3880         (WTF::VectorTypeOperations::compare):
3881         (WTF::VectorBufferBase::allocateBuffer):
3882         (WTF::VectorBufferBase::tryAllocateBuffer):
3883         (WTF::VectorBufferBase::shouldReallocateBuffer):
3884         (WTF::VectorBufferBase::reallocateBuffer):
3885         (WTF::VectorBufferBase::capacity):
3886         (WTF::VectorBufferBase::VectorBufferBase):
3887         (WTF::VectorBuffer::VectorBuffer):
3888         (WTF::VectorBuffer::allocateBuffer):
3889         (WTF::VectorBuffer::tryAllocateBuffer):
3890         (WTF::VectorBuffer::shouldReallocateBuffer):
3891         (WTF::VectorBuffer::reallocateBuffer):
3892         (WTF::VectorBuffer::swap):
3893         (WTF::VectorBuffer::swapInlineBuffer):
3894         (WTF::VectorBuffer::swapInlineBuffers):
3895         (WTF::Vector::Vector):
3896         (WTF::Vector::capacity):
3897         (WTF::Vector::at):
3898         (WTF::Vector::operator[]):
3899         (WTF::OverflowHandler>::find):
3900         (WTF::OverflowHandler>::reverseFind):
3901         (WTF::OverflowHandler>::fill):
3902         (WTF::OverflowHandler>::expandCapacity):
3903         (WTF::OverflowHandler>::tryExpandCapacity):
3904         (WTF::OverflowHandler>::resize):
3905         (WTF::OverflowHandler>::resizeToFit):
3906         (WTF::OverflowHandler>::shrink):
3907         (WTF::OverflowHandler>::grow):
3908         (WTF::OverflowHandler>::reserveCapacity):
3909         (WTF::OverflowHandler>::tryReserveCapacity):
3910         (WTF::OverflowHandler>::reserveInitialCapacity):
3911         (WTF::OverflowHandler>::shrinkCapacity):
3912         (WTF::OverflowHandler>::append):
3913         (WTF::OverflowHandler>::tryAppend):
3914         (WTF::OverflowHandler>::insert):
3915         (WTF::OverflowHandler>::insertVector):
3916         (WTF::OverflowHandler>::remove):
3917         (WTF::OverflowHandler>::reverse):
3918         (WTF::OverflowHandler>::checkConsistency):
3919         * wtf/text/AtomicString.h:
3920         * wtf/text/StringImpl.h:
3921         (WTF::StringImpl::adopt):
3922         (WTF::equalIgnoringNullity):
3923         * wtf/text/StringView.h:
3924         (WTF::append):
3925         * wtf/text/WTFString.h:
3926
3927 2014-12-07  Andreas Kling  <akling@apple.com>
3928
3929         Use more PassRef in AtomicString.
3930         <https://webkit.org/b/139319>
3931
3932         Reviewed by Antti Koivisto.
3933
3934         Make a pass over AtomicString and convert functions that return PassRefPtr
3935         into returning RefPtr (where it may be null) and PassRef otherwise.
3936         This allows the compiler to skip null checks in many places.
3937
3938         * wtf/text/AtomicString.cpp:
3939         (WTF::addToStringTable):
3940         (WTF::AtomicString::add):
3941         (WTF::AtomicString::addFromLiteralData):
3942         (WTF::AtomicString::addSlowCase):
3943         * wtf/text/AtomicString.h:
3944         (WTF::AtomicString::add):
3945         (WTF::AtomicString::addWithStringTableProvider):
3946         * wtf/text/cf/AtomicStringCF.cpp:
3947         (WTF::AtomicString::add):
3948
3949 2014-12-05  Roger Fong  <roger_fong@apple.com>
3950
3951         [Win] proj files copying over too many resources..
3952         https://bugs.webkit.org/show_bug.cgi?id=139315.
3953         <rdar://problem/19148278>
3954
3955         Reviewed by Brent Fulgham.
3956
3957         * WTF.vcxproj/WTF.proj: Only copy WTF.dll.
3958
3959 2014-12-05  Andreas Kling  <akling@apple.com>
3960
3961         PassRef should deref on destruction if pointee was not moved.
3962         <https://webkit.org/b/139309>
3963
3964         Reviewed by Antti Koivisto.
3965
3966         Let PassRef become nullptr internally after having WTF::move()'d the pointee.
3967         This means that PassRef is now essentially a PassRefPtr that can only be
3968         constructed with a non-null pointee.
3969
3970         This should make it possible for all ::create()-style construction helpers to
3971         return PassRef, removing a branch in each case.
3972
3973         * wtf/PassRef.h:
3974         (WTF::PassRef<T>::PassRef):
3975         (WTF::PassRef<T>::~PassRef):
3976         (WTF::PassRef<T>::get):
3977         (WTF::PassRef<T>::ptr):
3978         (WTF::PassRef<T>::leakRef):
3979         (WTF::PassRef<T>::dropRef): Deleted.
3980
3981 2014-12-05  Jer Noble  <jer.noble@apple.com>
3982
3983         [WTF] MediaTime should support round-tripping from and to doubles.
3984         https://bugs.webkit.org/show_bug.cgi?id=139248
3985
3986         Reviewed by Eric Carlson.
3987
3988         MediaTimes should be able to return precisely the same double value as was used
3989         when the MediaTime was created, so long as that MediaTime was not modified in a
3990         non-destructive way. This will allow API which accepts floating-point values to
3991         return the exact same value when asked, but still be able to store that value
3992         as a MediaTime.
3993
3994         * wtf/MediaTime.cpp:
3995         (WTF::MediaTime::createWithFloat): Added; store the floating-point value in a union.
3996         (WTF::MediaTime::createWithDouble): Ditto.
3997         (WTF::MediaTime::toFloat): If the value is a double, just return it.
3998         (WTF::MediaTime::toDouble): Ditto.
3999         (WTF::MediaTime::operator+): Special case when one or both sides are doubles.
4000         (WTF::MediaTime::operator-): Ditto.
4001         (WTF::MediaTime::operator*): Ditto.
4002         (WTF::MediaTime::compare): Ditto.
4003         (WTF::abs): Ditto.
4004         (WTF::MediaTime::setTimeScale): Convert the MediaTime from a double.
4005
4006 2014-12-05  peavo@outlook.com  <peavo@outlook.com>
4007
4008         [WinCairo] WTF project is missing a GStreamer source file.
4009         https://bugs.webkit.org/show_bug.cgi?id=139296
4010
4011         Reviewed by Philippe Normand.
4012
4013         The WTF project file is missing a GStreamer source file,
4014         causing a link error when compiling with GStreamer enabled.
4015
4016         * WTF.vcxproj/WTF.vcxproj:
4017         * WTF.vcxproj/WTF.vcxproj.filters:
4018
4019 2014-12-04  David Kilzer  <ddkilzer@apple.com>
4020
4021         REGRESSION (r176683): RefCounter.h is installed outside SDKROOT
4022
4023         * WTF.xcodeproj/project.pbxproj: Don't mark RefCounter.h as a
4024         private header.  WTF headers use a special build phase script to
4025         be installed.
4026
4027 2014-12-04  Anders Carlsson  <andersca@apple.com>
4028
4029         Make API::String copy the underlying strings if needed, for thread safety
4030         https://bugs.webkit.org/show_bug.cgi?id=139261
4031
4032         Reviewed by Sam Weinig.
4033
4034         * wtf/RefPtr.h:
4035         (WTF::RefPtr<T>::leakRef):
4036         Add a leakRef() to RefPtr so we don't have to go through PassRefPtr.
4037
4038         * wtf/text/WTFString.cpp:
4039         (WTF::String::isSafeToSendToAnotherThread):
4040         Check if the string is empty before checking whether it's in an atomic string table.
4041         It's safe to send empty strings to other threads even if they're in the atomic string table
4042         since they will never be deallocated.
4043
4044 2014-12-04  Csaba Osztrogonác  <ossy@webkit.org>
4045
4046         Fix cast-align warning in StringImpl.h
4047         https://bugs.webkit.org/show_bug.cgi?id=139222
4048
4049         Reviewed by Anders Carlsson.
4050
4051         * wtf/text/StringImpl.h:
4052         (WTF::StringImpl::tailPointer):
4053
4054 2014-12-02  Mark Lam  <mark.lam@apple.com>
4055
4056         Rolling out r176592, r176603, r176616, and r176705 until build and perf issues are resolved.
4057         https://bugs.webkit.org/show_bug.cgi?id=138821
4058
4059         Not reviewed.
4060
4061         * WTF.vcxproj/WTF.vcxproj:
4062         * WTF.vcxproj/WTF.vcxproj.filters:
4063         * WTF.xcodeproj/project.pbxproj:
4064         * wtf/IndexedIterator.h: Removed.
4065         * wtf/RefCountedArray.h:
4066         (WTF::RefCountedArray::RefCountedArray):
4067         * wtf/Vector.h:
4068         (WTF::Vector::Vector):
4069         (WTF::Vector::begin):
4070         (WTF::Vector::end):
4071         (WTF::OverflowHandler>::Vector):
4072         (WTF::=):
4073         (WTF::OverflowHandler>::fill):
4074         (WTF::OverflowHandler>::expandCapacity):
4075         (WTF::OverflowHandler>::tryExpandCapacity):
4076         (WTF::OverflowHandler>::resize):
4077         (WTF::OverflowHandler>::shrink):
4078         (WTF::OverflowHandler>::grow):
4079         (WTF::OverflowHandler>::reserveCapacity):
4080         (WTF::OverflowHandler>::tryReserveCapacity):
4081         (WTF::OverflowHandler>::shrinkCapacity):
4082         (WTF::OverflowHandler>::append):
4083         (WTF::OverflowHandler>::tryAppend):
4084         (WTF::OverflowHandler>::appendSlowCase):
4085         (WTF::OverflowHandler>::uncheckedAppend):
4086         (WTF::OverflowHandler>::appendVector):
4087         (WTF::OverflowHandler>::insert):
4088         (WTF::OverflowHandler>::insertVector):
4089         (WTF::OverflowHandler>::remove):
4090
4091 2014-12-02  Oliver Hunt  <oliver@apple.com>
4092
4093         Fix IOS builds.
4094
4095         * wtf/IndexedIterator.h:
4096
4097 2014-12-02  Gavin Barraclough  <barraclough@apple.com>
4098
4099         Generalize PageActivityAssertionToken
4100         https://bugs.webkit.org/show_bug.cgi?id=139106
4101
4102         Reviewed by Sam Weinig.
4103
4104         PageActivityAssertionToken is a RAII mechanism implementing a counter, used by PageThrottler
4105         to count user visible activity in progress on the page (currently page load and media playback).
4106         Use of an RAII type is prevents a number of possible errors, including double counting a single
4107         media element, or failing to decrement the count after a media element has been deallocated.
4108
4109         The current implementation has a number of drawbacks that have been addressed by this refactoring:
4110          - specific to single use in PageThrottler class - not reusable.
4111          - incomplete encapsulation - the counter and WeakPtrFactory that comprise the current implementation
4112            are not encapsulated (are in the client type, PageThrottler).
4113          - tokens are not shared - PageActivityAssertionToken instances are managed by std::unique, every
4114            increment requires an object allocation.
4115          - redundancy - the current implementation uses a WeakPtr to safely reference the PageThrottler, this
4116            is internally implemented using a reference counted type, resulting in two counters being
4117            incremented (one in the PageActivityAssertionToken, one in the PageThrottler).
4118
4119         In the reimplementation:
4120          - a callback is provided via a lambda function, which allows for easy reuse without a lot of
4121            boilerplate code.
4122          - the counter, callback and ownership of the otherwise weakly-owned token is encapsulated within the
4123            RefCounter type.
4124          - a single count within RefCounter::Count stores the counter value, and also manage the lifetime
4125            of this object.
4126          - standard RefPtrs are used to manage references to the RefCounter::Count.
4127
4128         * WTF.xcodeproj/project.pbxproj:
4129             - added RefCounter.cpp/.h
4130         * wtf/RefCounter.cpp: Added.
4131         (WTF::RefCounter::Count::ref):
4132             - increment the counter.
4133         (WTF::RefCounter::Count::deref):
4134             - decrement the counter, and delete as necessary.
4135         (WTF::RefCounter::RefCounter):
4136             - create a RefCounter::Count.
4137         (WTF::RefCounter::~RefCounter):
4138             - eagerly delete the Counter if it has no references, otherwise let it be deleted on last deref.
4139         * wtf/RefCounter.h: Added.
4140         (WTF::RefCounter::Count::Count):
4141             - initialize count to 0.
4142         (WTF::RefCounter::RefCounter):
4143             - takes a lambda to be called when the value changes.
4144         (WTF::RefCounter::count):
4145             - reference the counter (and in doing so increment the count).
4146         (WTF::RefCounter::value):
4147             - access the current value of the counter.
4148
4149 2014-12-01  Andreas Kling  <akling@apple.com>
4150
4151         Optimize constructing JSC::Identifier from AtomicString.
4152         <https://webkit.org/b/139157>
4153
4154         Reviewed by Michael Saboff.
4155
4156         Make AtomicString::isInAtomicStringTable() public so it can be used
4157         in some Identifier assertions.
4158
4159         * wtf/text/AtomicString.h:
4160
4161 2014-12-01  Oliver Hunt  <oliver@apple.com>
4162
4163         Fix non-mac builds.
4164
4165         * wtf/IndexedIterator.h:
4166
4167 2014-12-01  Oliver Hunt  <oliver@apple.com>
4168
4169         Fix 32-bit build.
4170
4171         * wtf/IndexedIterator.h:
4172
4173 2014-11-17  Oliver Hunt  <oliver@apple.com>
4174
4175         Make sure range based iteration of Vector<> still receives bounds checking
4176         https://bugs.webkit.org/show_bug.cgi?id=138821
4177
4178         Reviewed by Mark Lam.
4179
4180         Add a new IndexedIterator struct to WTF that wraps a
4181         Vector type and index to provide pointer like semantics
4182         while still performing runtime bounds checking, even in
4183         release builds. We store a simple index into the vector
4184         which means that this iterator allows vector resizing
4185         during iteration. If the vector is resized such that the
4186         iterator is out of bounds, then any attempt to dereference
4187         the iterator will crash safely. Any other errors, including
4188         overflows, and over extending the iterator will likewise
4189         crash.
4190
4191         For the purpose of retaining semantically equivalent
4192         behaviour, the iterator can be moved to m_index == size()
4193         as that is the standard "end" terminator for these types.
4194         Attempting to dereference at that point will still crash
4195         rather than perform an unsafe memory operation.
4196
4197         In order to maintain the validity of all the bounds checking,
4198         we perform full integer range checking prior to any mutation
4199         of the iterator location. If we detect an arithmetic overflow
4200         we will crash rather than attempting to carry on.
4201
4202         By necessity there are many overrides for operator + and - as
4203         we otherwise hit many different type promotion ambiguities when
4204         performing arithmetic with iterators. These ambiguities are also
4205         different for 32- vs. 64-bit, so duplicating the functions
4206         and then forwarding to the core implementations that performed
4207         the bounds checking and mutation seemed like the right call.
4208
4209         * WTF.xcodeproj/project.pbxproj:
4210         * wtf/IndexedIterator.h: Added.
4211         (WTF::IndexedIterator::IndexedIterator):
4212         (WTF::IndexedIterator::operator->):
4213         (WTF::IndexedIterator::operator*):
4214         (WTF::IndexedIterator::get):
4215         (WTF::IndexedIterator::operator++):
4216         (WTF::IndexedIterator::operator--):
4217         (WTF::IndexedIterator::operator UnspecifiedBoolType):
4218         (WTF::IndexedIterator::operator+=):
4219         (WTF::IndexedIterator::operator-=):
4220         (WTF::IndexedIterator::operator+):
4221         (WTF::IndexedIterator::operator-):
4222         (WTF::IndexedIterator::operator=):
4223         (WTF::IndexedIterator::operator==):
4224         (WTF::IndexedIterator::operator!=):
4225         (WTF::IndexedIterator::operator<):
4226         (WTF::IndexedIterator::operator<=):
4227         (WTF::IndexedIterator::operator>):
4228         (WTF::IndexedIterator::operator>=):
4229         (WTF::IndexedIterator::operator const_iterator):
4230         (WTF::IndexedIterator::isSafeToCompare):
4231         (WTF::IndexedIterator::unsafeGet):
4232         (WTF::getPtr):
4233         (WTF::operator-):
4234         (WTF::operator==):
4235         (WTF::operator!=):
4236         (WTF::operator<=):
4237         (WTF::operator>=):
4238         (WTF::operator<):
4239         (WTF::operator>):
4240         (WTF::IndexedIteratorSelector::makeIterator):
4241         (WTF::IndexedIteratorSelector::makeConstIterator):
4242         * wtf/RefCountedArray.h:
4243         (WTF::RefCountedArray::RefCountedArray):
4244         * wtf/Vector.h:
4245         (WTF::Vector::Vector):
4246         (WTF::Vector::begin):
4247         (WTF::Vector::end):
4248         (WTF::OverflowHandler>::Vector):
4249         (WTF::=):
4250         (WTF::OverflowHandler>::fill):
4251         (WTF::OverflowHandler>::expandCapacity):
4252         (WTF::OverflowHandler>::tryExpandCapacity):
4253         (WTF::OverflowHandler>::resize):
4254         (WTF::OverflowHandler>::shrink):
4255         (WTF::OverflowHandler>::grow):
4256         (WTF::OverflowHandler>::reserveCapacity):
4257         (WTF::OverflowHandler>::tryReserveCapacity):
4258         (WTF::OverflowHandler>::shrinkCapacity):
4259         (WTF::OverflowHandler>::append):
4260         (WTF::OverflowHandler>::tryAppend):
4261         (WTF::OverflowHandler>::appendSlowCase):
4262         (WTF::OverflowHandler>::uncheckedAppend):
4263         (WTF::OverflowHandler>::appendVector):
4264         (WTF::OverflowHandler>::insert):
4265         (WTF::OverflowHandler>::insertVector):
4266         (WTF::OverflowHandler>::remove):
4267
4268 2014-11-30  Ryuan Choi  <ryuan.choi@navercorp.com>
4269
4270         [EFL] Drop support for the EFL 1.7
4271         https://bugs.webkit.org/show_bug.cgi?id=139114
4272
4273         Reviewed by Gyuyoung Kim.
4274
4275         * wtf/efl/EflTypedefs.h: Removed old definitions which EFL 1.7 used.
4276
4277 2014-11-21  Anders Carlsson  <andersca@apple.com>
4278
4279         Remove the Timer parameters from timer callbacks
4280         https://bugs.webkit.org/show_bug.cgi?id=138974