OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bool isValid = event.type() < ParamEvent::LastType | 74 bool isValid = event.type() < ParamEvent::LastType |
75 && isValidNumber(event.value()) | 75 && isValidNumber(event.value()) |
76 && isValidNumber(event.time()) | 76 && isValidNumber(event.time()) |
77 && isValidNumber(event.timeConstant()) | 77 && isValidNumber(event.timeConstant()) |
78 && isValidNumber(event.duration()) | 78 && isValidNumber(event.duration()) |
79 && event.duration() >= 0; | 79 && event.duration() >= 0; |
80 | 80 |
81 ASSERT(isValid); | 81 ASSERT(isValid); |
82 if (!isValid) | 82 if (!isValid) |
83 return; | 83 return; |
84 | 84 |
85 MutexLocker locker(m_eventsLock); | 85 MutexLocker locker(m_eventsLock); |
86 | 86 |
87 unsigned i = 0; | 87 unsigned i = 0; |
88 double insertTime = event.time(); | 88 double insertTime = event.time(); |
89 for (i = 0; i < m_events.size(); ++i) { | 89 for (i = 0; i < m_events.size(); ++i) { |
90 // Overwrite same event type and time. | 90 // Overwrite same event type and time. |
91 if (m_events[i].time() == insertTime && m_events[i].type() == event.type
()) { | 91 if (m_events[i].time() == insertTime && m_events[i].type() == event.type
()) { |
92 m_events[i] = event; | 92 m_events[i] = event; |
93 return; | 93 return; |
94 } | 94 } |
95 | 95 |
96 if (m_events[i].time() > insertTime) | 96 if (m_events[i].time() > insertTime) |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 // to the end of the values buffer. | 364 // to the end of the values buffer. |
365 for (; writeIndex < numberOfValues; ++writeIndex) | 365 for (; writeIndex < numberOfValues; ++writeIndex) |
366 values[writeIndex] = value; | 366 values[writeIndex] = value; |
367 | 367 |
368 return value; | 368 return value; |
369 } | 369 } |
370 | 370 |
371 } // namespace WebCore | 371 } // namespace WebCore |
372 | 372 |
373 #endif // ENABLE(WEB_AUDIO) | 373 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |