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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceBase.cpp

Issue 2952413002: Remove out of spec FrameTiming members from Performance.idl (Closed)
Patch Set: More Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/timing/PerformanceBase.h ('k') | no next file » | 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel 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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void PerformanceBase::clearResourceTimings() { 218 void PerformanceBase::clearResourceTimings() {
219 resource_timing_buffer_.clear(); 219 resource_timing_buffer_.clear();
220 } 220 }
221 221
222 void PerformanceBase::setResourceTimingBufferSize(unsigned size) { 222 void PerformanceBase::setResourceTimingBufferSize(unsigned size) {
223 resource_timing_buffer_size_ = size; 223 resource_timing_buffer_size_ = size;
224 if (IsResourceTimingBufferFull()) 224 if (IsResourceTimingBufferFull())
225 DispatchEvent(Event::Create(EventTypeNames::resourcetimingbufferfull)); 225 DispatchEvent(Event::Create(EventTypeNames::resourcetimingbufferfull));
226 } 226 }
227 227
228 void PerformanceBase::clearFrameTimings() {
229 frame_timing_buffer_.clear();
230 }
231
232 void PerformanceBase::setFrameTimingBufferSize(unsigned size) {
233 frame_timing_buffer_size_ = size;
234 if (IsFrameTimingBufferFull())
235 DispatchEvent(Event::Create(EventTypeNames::frametimingbufferfull));
236 }
237
238 bool PerformanceBase::PassesTimingAllowCheck( 228 bool PerformanceBase::PassesTimingAllowCheck(
239 const ResourceResponse& response, 229 const ResourceResponse& response,
240 const SecurityOrigin& initiator_security_origin, 230 const SecurityOrigin& initiator_security_origin,
241 const AtomicString& original_timing_allow_origin, 231 const AtomicString& original_timing_allow_origin,
242 ExecutionContext* context) { 232 ExecutionContext* context) {
243 RefPtr<SecurityOrigin> resource_origin = 233 RefPtr<SecurityOrigin> resource_origin =
244 SecurityOrigin::Create(response.Url()); 234 SecurityOrigin::Create(response.Url());
245 if (resource_origin->IsSameSchemeHostPort(&initiator_security_origin)) 235 if (resource_origin->IsSameSchemeHostPort(&initiator_security_origin))
246 return true; 236 return true;
247 237
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 resource_timing_buffer_.push_back(&entry); 371 resource_timing_buffer_.push_back(&entry);
382 372
383 if (IsResourceTimingBufferFull()) 373 if (IsResourceTimingBufferFull())
384 DispatchEvent(Event::Create(EventTypeNames::resourcetimingbufferfull)); 374 DispatchEvent(Event::Create(EventTypeNames::resourcetimingbufferfull));
385 } 375 }
386 376
387 bool PerformanceBase::IsResourceTimingBufferFull() { 377 bool PerformanceBase::IsResourceTimingBufferFull() {
388 return resource_timing_buffer_.size() >= resource_timing_buffer_size_; 378 return resource_timing_buffer_.size() >= resource_timing_buffer_size_;
389 } 379 }
390 380
391 void PerformanceBase::AddFrameTimingBuffer(PerformanceEntry& entry) {
392 frame_timing_buffer_.push_back(&entry);
393
394 if (IsFrameTimingBufferFull())
395 DispatchEvent(Event::Create(EventTypeNames::frametimingbufferfull));
396 }
397
398 bool PerformanceBase::IsFrameTimingBufferFull() {
399 return frame_timing_buffer_.size() >= frame_timing_buffer_size_;
400 }
401
402 void PerformanceBase::AddLongTaskTiming(double start_time, 381 void PerformanceBase::AddLongTaskTiming(double start_time,
403 double end_time, 382 double end_time,
404 const String& name, 383 const String& name,
405 const String& frame_src, 384 const String& frame_src,
406 const String& frame_id, 385 const String& frame_id,
407 const String& frame_name) { 386 const String& frame_name) {
408 if (!HasObserverFor(PerformanceEntry::kLongTask)) 387 if (!HasObserverFor(PerformanceEntry::kLongTask))
409 return; 388 return;
410 PerformanceEntry* entry = PerformanceLongTaskTiming::Create( 389 PerformanceEntry* entry = PerformanceLongTaskTiming::Create(
411 MonotonicTimeToDOMHighResTimeStamp(start_time), 390 MonotonicTimeToDOMHighResTimeStamp(start_time),
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 visitor->Trace(user_timing_); 545 visitor->Trace(user_timing_);
567 visitor->Trace(first_paint_timing_); 546 visitor->Trace(first_paint_timing_);
568 visitor->Trace(first_contentful_paint_timing_); 547 visitor->Trace(first_contentful_paint_timing_);
569 visitor->Trace(observers_); 548 visitor->Trace(observers_);
570 visitor->Trace(active_observers_); 549 visitor->Trace(active_observers_);
571 visitor->Trace(suspended_observers_); 550 visitor->Trace(suspended_observers_);
572 EventTargetWithInlineData::Trace(visitor); 551 EventTargetWithInlineData::Trace(visitor);
573 } 552 }
574 553
575 } // namespace blink 554 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/timing/PerformanceBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698