| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
| 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
| 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/fetch/ScriptResource.h" | 28 #include "core/fetch/ScriptResource.h" |
| 29 | 29 |
| 30 #include "core/fetch/FetchRequest.h" | 30 #include "core/fetch/FetchRequest.h" |
| 31 #include "core/fetch/ResourceClientWalker.h" | 31 #include "core/fetch/ResourceClientWalker.h" |
| 32 #include "core/fetch/ResourceFetcher.h" | 32 #include "core/fetch/ResourceFetcher.h" |
| 33 #include "platform/MIMETypeRegistry.h" | 33 #include "platform/MIMETypeRegistry.h" |
| 34 #include "platform/SharedBuffer.h" | 34 #include "platform/SharedBuffer.h" |
| 35 #include "platform/network/HTTPParsers.h" | 35 #include "platform/network/HTTPParsers.h" |
| 36 #include "public/platform/WebProcessMemoryDump.h" |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 ResourcePtr<ScriptResource> ScriptResource::fetch(FetchRequest& request, Resourc
eFetcher* fetcher) | 40 ResourcePtr<ScriptResource> ScriptResource::fetch(FetchRequest& request, Resourc
eFetcher* fetcher) |
| 40 { | 41 { |
| 41 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); | 42 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); |
| 42 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textScript); | 43 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textScript); |
| 43 return toScriptResource(fetcher->requestResource(request, ScriptResourceFact
ory())); | 44 return toScriptResource(fetcher->requestResource(request, ScriptResourceFact
ory())); |
| 44 } | 45 } |
| 45 | 46 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 65 } | 66 } |
| 66 | 67 |
| 67 void ScriptResource::appendData(const char* data, unsigned length) | 68 void ScriptResource::appendData(const char* data, unsigned length) |
| 68 { | 69 { |
| 69 Resource::appendData(data, length); | 70 Resource::appendData(data, length); |
| 70 ResourceClientWalker<ScriptResourceClient> walker(m_clients); | 71 ResourceClientWalker<ScriptResourceClient> walker(m_clients); |
| 71 while (ScriptResourceClient* client = walker.next()) | 72 while (ScriptResourceClient* client = walker.next()) |
| 72 client->notifyAppendData(this); | 73 client->notifyAppendData(this); |
| 73 } | 74 } |
| 74 | 75 |
| 76 void ScriptResource::onMemoryDump(WebProcessMemoryDump* memoryDump) const |
| 77 { |
| 78 Resource::onMemoryDump(memoryDump); |
| 79 const String name = getMemoryDumpName() + "/decoded_script"; |
| 80 auto dump = memoryDump->createMemoryAllocatorDump(name); |
| 81 dump->AddScalar("size", "bytes", m_script.string().sizeInBytes()); |
| 82 memoryDump->AddSuballocation(dump->guid(), String(WTF::Partitions::kAllocate
dObjectPoolName)); |
| 83 } |
| 84 |
| 75 AtomicString ScriptResource::mimeType() const | 85 AtomicString ScriptResource::mimeType() const |
| 76 { | 86 { |
| 77 return extractMIMETypeFromMediaType(m_response.httpHeaderField("Content-Type
")).lower(); | 87 return extractMIMETypeFromMediaType(m_response.httpHeaderField("Content-Type
")).lower(); |
| 78 } | 88 } |
| 79 | 89 |
| 80 const String& ScriptResource::script() | 90 const String& ScriptResource::script() |
| 81 { | 91 { |
| 82 ASSERT(!isPurgeable()); | 92 ASSERT(!isPurgeable()); |
| 83 ASSERT(isLoaded()); | 93 ASSERT(isLoaded()); |
| 84 | 94 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 104 { | 114 { |
| 105 if (request.integrityMetadata().isEmpty()) | 115 if (request.integrityMetadata().isEmpty()) |
| 106 return false; | 116 return false; |
| 107 | 117 |
| 108 // TODO(jww) this integrity metadata should actually be | 118 // TODO(jww) this integrity metadata should actually be |
| 109 // normalized so that order doesn't matter. | 119 // normalized so that order doesn't matter. |
| 110 return m_integrityMetadata != request.integrityMetadata(); | 120 return m_integrityMetadata != request.integrityMetadata(); |
| 111 } | 121 } |
| 112 | 122 |
| 113 } // namespace blink | 123 } // namespace blink |
| OLD | NEW |