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

Side by Side Diff: third_party/WebKit/Source/wtf/Deque.h

Issue 1845923005: CL for perf tryjob on android Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/BitArray.h ('k') | third_party/WebKit/Source/wtf/Functional.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 T& first() { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; } 77 T& first() { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; }
78 const T& first() const { ASSERT(m_start != m_end); return m_buffer.buffer()[ m_start]; } 78 const T& first() const { ASSERT(m_start != m_end); return m_buffer.buffer()[ m_start]; }
79 T takeFirst(); 79 T takeFirst();
80 80
81 T& last() { ASSERT(m_start != m_end); return *(--end()); } 81 T& last() { ASSERT(m_start != m_end); return *(--end()); }
82 const T& last() const { ASSERT(m_start != m_end); return *(--end()); } 82 const T& last() const { ASSERT(m_start != m_end); return *(--end()); }
83 T takeLast(); 83 T takeLast();
84 84
85 T& at(size_t i) 85 T& at(size_t i)
86 { 86 {
87 CHECK_LT(i, size()); 87 RELEASE_ASSERT(i < size());
88 size_t right = m_buffer.capacity() - m_start; 88 size_t right = m_buffer.capacity() - m_start;
89 return i < right ? m_buffer.buffer()[m_start + i] : m_buffer.buffer()[i - right]; 89 return i < right ? m_buffer.buffer()[m_start + i] : m_buffer.buffer()[i - right];
90 } 90 }
91 const T& at(size_t i) const 91 const T& at(size_t i) const
92 { 92 {
93 CHECK_LT(i, size()); 93 RELEASE_ASSERT(i < size());
94 size_t right = m_buffer.capacity() - m_start; 94 size_t right = m_buffer.capacity() - m_start;
95 return i < right ? m_buffer.buffer()[m_start + i] : m_buffer.buffer()[i - right]; 95 return i < right ? m_buffer.buffer()[m_start + i] : m_buffer.buffer()[i - right];
96 } 96 }
97 97
98 T& operator[](size_t i) { return at(i); } 98 T& operator[](size_t i) { return at(i); }
99 const T& operator[](size_t i) const { return at(i); } 99 const T& operator[](size_t i) const { return at(i); }
100 100
101 template <typename U> void append(U&&); 101 template <typename U> void append(U&&);
102 template <typename U> void prepend(U&&); 102 template <typename U> void prepend(U&&);
103 void removeFirst(); 103 void removeFirst();
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 ASSERT(m_deque->m_buffer.capacity()); 569 ASSERT(m_deque->m_buffer.capacity());
570 if (!m_index) 570 if (!m_index)
571 m_index = m_deque->m_buffer.capacity() - 1; 571 m_index = m_deque->m_buffer.capacity() - 1;
572 else 572 else
573 --m_index; 573 --m_index;
574 } 574 }
575 575
576 template <typename T, size_t inlineCapacity, typename Allocator> 576 template <typename T, size_t inlineCapacity, typename Allocator>
577 inline T* DequeIteratorBase<T, inlineCapacity, Allocator>::after() const 577 inline T* DequeIteratorBase<T, inlineCapacity, Allocator>::after() const
578 { 578 {
579 CHECK_NE(m_index, m_deque->m_end); 579 RELEASE_ASSERT(m_index != m_deque->m_end);
580 return &m_deque->m_buffer.buffer()[m_index]; 580 return &m_deque->m_buffer.buffer()[m_index];
581 } 581 }
582 582
583 template <typename T, size_t inlineCapacity, typename Allocator> 583 template <typename T, size_t inlineCapacity, typename Allocator>
584 inline T* DequeIteratorBase<T, inlineCapacity, Allocator>::before() const 584 inline T* DequeIteratorBase<T, inlineCapacity, Allocator>::before() const
585 { 585 {
586 CHECK_NE(m_index, m_deque->m_start); 586 RELEASE_ASSERT(m_index != m_deque->m_start);
587 if (!m_index) 587 if (!m_index)
588 return &m_deque->m_buffer.buffer()[m_deque->m_buffer.capacity() - 1]; 588 return &m_deque->m_buffer.buffer()[m_deque->m_buffer.capacity() - 1];
589 return &m_deque->m_buffer.buffer()[m_index - 1]; 589 return &m_deque->m_buffer.buffer()[m_index - 1];
590 } 590 }
591 591
592 // This is only called if the allocator is a HeapAllocator. It is used when 592 // This is only called if the allocator is a HeapAllocator. It is used when
593 // visiting during a tracing GC. 593 // visiting during a tracing GC.
594 template <typename T, size_t inlineCapacity, typename Allocator> 594 template <typename T, size_t inlineCapacity, typename Allocator>
595 template <typename VisitorDispatcher> 595 template <typename VisitorDispatcher>
596 void Deque<T, inlineCapacity, Allocator>::trace(VisitorDispatcher visitor) 596 void Deque<T, inlineCapacity, Allocator>::trace(VisitorDispatcher visitor)
(...skipping 28 matching lines...) Expand all
625 struct NeedsTracing<Deque<T, N>> { 625 struct NeedsTracing<Deque<T, N>> {
626 static const bool value = false; 626 static const bool value = false;
627 }; 627 };
628 #endif 628 #endif
629 629
630 } // namespace WTF 630 } // namespace WTF
631 631
632 using WTF::Deque; 632 using WTF::Deque;
633 633
634 #endif // WTF_Deque_h 634 #endif // WTF_Deque_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/BitArray.h ('k') | third_party/WebKit/Source/wtf/Functional.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698