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

Side by Side Diff: Source/core/inspector/InspectorPageAgent.cpp

Issue 633073002: DevTools: PageAgent: do not use ScriptResource::script as it changes state. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | 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) 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 *result = ""; 272 *result = "";
273 return true; 273 return true;
274 } 274 }
275 275
276 if (cachedResource) { 276 if (cachedResource) {
277 switch (cachedResource->type()) { 277 switch (cachedResource->type()) {
278 case Resource::CSSStyleSheet: 278 case Resource::CSSStyleSheet:
279 *result = toCSSStyleSheetResource(cachedResource)->sheetText(false); 279 *result = toCSSStyleSheetResource(cachedResource)->sheetText(false);
280 return true; 280 return true;
281 case Resource::Script: 281 case Resource::Script:
282 *result = toScriptResource(cachedResource)->script(); 282 *result = cachedResource->resourceBuffer() ? toScriptResource(cached Resource)->decodedText() : toScriptResource(cachedResource)->script();
283 return true; 283 return true;
284 case Resource::Raw: { 284 case Resource::Raw: {
285 SharedBuffer* buffer = cachedResource->resourceBuffer(); 285 SharedBuffer* buffer = cachedResource->resourceBuffer();
286 if (!buffer) 286 if (!buffer)
287 return false; 287 return false;
288 OwnPtr<TextResourceDecoder> decoder = createXHRTextDecoder(cachedRes ource->response().mimeType(), cachedResource->response().textEncodingName()); 288 OwnPtr<TextResourceDecoder> decoder = createXHRTextDecoder(cachedRes ource->response().mimeType(), cachedResource->response().textEncodingName());
289 String content = decoder->decode(buffer->data(), buffer->size()); 289 String content = decoder->decode(buffer->data(), buffer->size());
290 *result = content + decoder->flush(); 290 *result = content + decoder->flush();
291 return true; 291 return true;
292 } 292 }
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 void InspectorPageAgent::trace(Visitor* visitor) 1486 void InspectorPageAgent::trace(Visitor* visitor)
1487 { 1487 {
1488 visitor->trace(m_page); 1488 visitor->trace(m_page);
1489 visitor->trace(m_injectedScriptManager); 1489 visitor->trace(m_injectedScriptManager);
1490 visitor->trace(m_inspectorResourceContentLoader); 1490 visitor->trace(m_inspectorResourceContentLoader);
1491 InspectorBaseAgent::trace(visitor); 1491 InspectorBaseAgent::trace(visitor);
1492 } 1492 }
1493 1493
1494 } // namespace blink 1494 } // namespace blink
1495 1495
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698