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

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: Support countDeprecation 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
« no previous file with comments | « Source/core/frame/UseCounter.h ('k') | Source/core/workers/DedicatedWorkerGlobalScope.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 /* 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)
617 return; 623 return;
618 UseCounter::countDeprecation(*toDocument(context), feature); 624 if (context->isDocument()) {
625 UseCounter::countDeprecation(*toDocument(context), feature);
626 return;
627 }
628 if (context->isWorkerGlobalScope())
629 toWorkerGlobalScope(context)->countDeprecation(feature);
619 } 630 }
620 631
621 void UseCounter::countDeprecation(const DOMWindow* window, Feature feature) 632 void UseCounter::countDeprecation(const DOMWindow* window, Feature feature)
622 { 633 {
623 if (!window || !window->document()) 634 if (!window || !window->document())
624 return; 635 return;
625 UseCounter::countDeprecation(*window->document(), feature); 636 UseCounter::countDeprecation(*window->document(), feature);
626 } 637 }
627 638
628 void UseCounter::countDeprecation(const Document& document, Feature feature) 639 void UseCounter::countDeprecation(const Document& document, Feature feature)
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) 786 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents)
776 { 787 {
777 // FIXME: We may want to handle stylesheets that have multiple owners 788 // FIXME: We may want to handle stylesheets that have multiple owners
778 // http://crbug.com/242125 789 // http://crbug.com/242125
779 if (sheetContents && sheetContents->hasSingleOwnerNode()) 790 if (sheetContents && sheetContents->hasSingleOwnerNode())
780 return getFrom(sheetContents->singleOwnerDocument()); 791 return getFrom(sheetContents->singleOwnerDocument());
781 return 0; 792 return 0;
782 } 793 }
783 794
784 } // namespace WebCore 795 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/UseCounter.h ('k') | Source/core/workers/DedicatedWorkerGlobalScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698