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

Side by Side Diff: Source/core/frame/UseCounter.cpp

Issue 342103003: Support UseCounter in dedicated workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright (C) 2012 Google, Inc. All rights reserved. 3 * Copyright (C) 2012 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 * 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 17 matching lines...) Expand all
28 #include "core/frame/UseCounter.h" 28 #include "core/frame/UseCounter.h"
29 29
30 #include "core/css/CSSStyleSheet.h" 30 #include "core/css/CSSStyleSheet.h"
31 #include "core/css/StyleSheetContents.h" 31 #include "core/css/StyleSheetContents.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "core/frame/DOMWindow.h" 34 #include "core/frame/DOMWindow.h"
35 #include "core/frame/FrameConsole.h" 35 #include "core/frame/FrameConsole.h"
36 #include "core/frame/FrameHost.h" 36 #include "core/frame/FrameHost.h"
37 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
38 #include "core/workers/WorkerGlobalScope.h"
38 #include "public/platform/Platform.h" 39 #include "public/platform/Platform.h"
39 40
40 namespace WebCore { 41 namespace WebCore {
41 42
42 static int totalPagesMeasuredCSSSampleId() { return 1; } 43 static int totalPagesMeasuredCSSSampleId() { return 1; }
43 44
44 int UseCounter::m_muteCount = 0; 45 int UseCounter::m_muteCount = 0;
45 46
46 // FIXME : This mapping should be autogenerated. This function should 47 // FIXME : This mapping should be autogenerated. This function should
47 // be moved to a separate file and a script run at build time 48 // be moved to a separate file and a script run at build time
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 FrameHost* host = document.frameHost(); 600 FrameHost* host = document.frameHost();
600 if (!host) 601 if (!host)
601 return; 602 return;
602 603
603 ASSERT(host->useCounter().deprecationMessage(feature).isEmpty()); 604 ASSERT(host->useCounter().deprecationMessage(feature).isEmpty());
604 host->useCounter().recordMeasurement(feature); 605 host->useCounter().recordMeasurement(feature);
605 } 606 }
606 607
607 void UseCounter::count(const ExecutionContext* context, Feature feature) 608 void UseCounter::count(const ExecutionContext* context, Feature feature)
608 { 609 {
609 if (!context || !context->isDocument()) 610 if (!context)
610 return; 611 return;
611 count(*toDocument(context), feature); 612 if (context->isDocument()) {
613 count(*toDocument(context), feature);
614 return;
615 }
616 if (context->isWorkerGlobalScope())
617 toWorkerGlobalScope(context)->countFeature(feature);
612 } 618 }
613 619
614 void UseCounter::countDeprecation(ExecutionContext* context, Feature feature) 620 void UseCounter::countDeprecation(ExecutionContext* context, Feature feature)
615 { 621 {
616 if (!context || !context->isDocument()) 622 if (!context || !context->isDocument())
617 return; 623 return;
618 UseCounter::countDeprecation(*toDocument(context), feature); 624 UseCounter::countDeprecation(*toDocument(context), feature);
619 } 625 }
620 626
621 void UseCounter::countDeprecation(const DOMWindow* window, Feature feature) 627 void UseCounter::countDeprecation(const DOMWindow* window, Feature feature)
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) 781 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents)
776 { 782 {
777 // FIXME: We may want to handle stylesheets that have multiple owners 783 // FIXME: We may want to handle stylesheets that have multiple owners
778 // http://crbug.com/242125 784 // http://crbug.com/242125
779 if (sheetContents && sheetContents->hasSingleOwnerNode()) 785 if (sheetContents && sheetContents->hasSingleOwnerNode())
780 return getFrom(sheetContents->singleOwnerDocument()); 786 return getFrom(sheetContents->singleOwnerDocument());
781 return 0; 787 return 0;
782 } 788 }
783 789
784 } // namespace WebCore 790 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698