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

Side by Side Diff: Source/core/page/PageConsole.cpp

Issue 20890003: Limit console messages' automatic collection of parser state. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaseline "fast/frames/sandboxed-iframe-autofocus-denied.html" Created 7 years, 4 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/page/PageConsole.h ('k') | Source/core/workers/WorkerGlobalScope.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) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple 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 28 matching lines...) Expand all
39 #include "core/page/ConsoleTypes.h" 39 #include "core/page/ConsoleTypes.h"
40 #include "core/page/Page.h" 40 #include "core/page/Page.h"
41 #include "wtf/text/WTFString.h" 41 #include "wtf/text/WTFString.h"
42 42
43 namespace WebCore { 43 namespace WebCore {
44 44
45 namespace { 45 namespace {
46 46
47 int muteCount = 0; 47 int muteCount = 0;
48 48
49 static bool shouldCollectParserStateForSourceType(MessageSource source)
50 {
51 return source == RenderingMessageSource || source == CSSMessageSource || sou rce == OtherMessageSource;
52 }
53
49 } 54 }
50 55
51 PageConsole::PageConsole(Page* page) 56 PageConsole::PageConsole(Page* page)
52 : m_page(page) 57 : m_page(page)
53 { 58 {
54 } 59 }
55 60
56 PageConsole::~PageConsole() { } 61 PageConsole::~PageConsole() { }
57 62
58 void PageConsole::addMessage(MessageSource source, MessageLevel level, const Str ing& message, unsigned long requestIdentifier, Document* document) 63 void PageConsole::addMessage(MessageSource source, MessageLevel level, const Str ing& message, unsigned long requestIdentifier, Document* document, ParserStateCo llectionDisposition parserStateDisposition)
59 { 64 {
60 String url; 65 String url;
61 if (document) 66 if (document)
62 url = document->url().string(); 67 url = document->url().string();
63 unsigned line = 0; 68 unsigned line = 0;
64 if (document && document->parsing() && !document->isInDocumentWrite() && doc ument->scriptableDocumentParser()) { 69 if ((shouldCollectParserStateForSourceType(source) || parserStateDisposition == ForceParserStateCollection) && document && document->parsing() && !document- >isInDocumentWrite() && document->scriptableDocumentParser()) {
65 ScriptableDocumentParser* parser = document->scriptableDocumentParser(); 70 ScriptableDocumentParser* parser = document->scriptableDocumentParser();
66 if (!parser->isWaitingForScripts() && !parser->isExecutingScript()) 71 if (!parser->isWaitingForScripts() && !parser->isExecutingScript())
67 line = parser->lineNumber().oneBasedInt(); 72 line = parser->lineNumber().oneBasedInt();
68 } 73 }
69 addMessage(source, level, message, url, line, 0, 0, 0, requestIdentifier); 74 addMessage(source, level, message, url, line, 0, 0, 0, requestIdentifier);
70 } 75 }
71 76
72 void PageConsole::addMessage(MessageSource source, MessageLevel level, const Str ing& message, PassRefPtr<ScriptCallStack> callStack) 77 void PageConsole::addMessage(MessageSource source, MessageLevel level, const Str ing& message, PassRefPtr<ScriptCallStack> callStack)
73 { 78 {
74 addMessage(source, level, message, String(), 0, 0, callStack, 0); 79 addMessage(source, level, message, String(), 0, 0, callStack, 0);
(...skipping 26 matching lines...) Expand all
101 } 106 }
102 107
103 // static 108 // static
104 void PageConsole::unmute() 109 void PageConsole::unmute()
105 { 110 {
106 ASSERT(muteCount > 0); 111 ASSERT(muteCount > 0);
107 muteCount--; 112 muteCount--;
108 } 113 }
109 114
110 } // namespace WebCore 115 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/PageConsole.h ('k') | Source/core/workers/WorkerGlobalScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698