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

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/CachedMetadata.cpp

Issue 2584423002: Loading: move core/fetch to platform/loader/fetch (Closed)
Patch Set: another try Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/fetch/CachedMetadata.h" 5 #include "platform/loader/fetch/CachedMetadata.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 CachedMetadata::CachedMetadata(const char* data, size_t size) { 9 CachedMetadata::CachedMetadata(const char* data, size_t size) {
10 // We need to define a local variable to use the constant in DCHECK. 10 // We need to define a local variable to use the constant in DCHECK.
11 constexpr auto kDataStart = CachedMetadata::kDataStart; 11 constexpr auto kDataStart = CachedMetadata::kDataStart;
12 // Serialized metadata should have non-empty data. 12 // Serialized metadata should have non-empty data.
13 DCHECK_GT(size, kDataStart); 13 DCHECK_GT(size, kDataStart);
14 DCHECK(data); 14 DCHECK(data);
15 15
16 m_serializedData.reserveInitialCapacity(size); 16 m_serializedData.reserveInitialCapacity(size);
17 m_serializedData.append(data, size); 17 m_serializedData.append(data, size);
18 } 18 }
19 19
20 CachedMetadata::CachedMetadata(uint32_t dataTypeID, 20 CachedMetadata::CachedMetadata(uint32_t dataTypeID,
21 const char* data, 21 const char* data,
22 size_t size) { 22 size_t size) {
23 // Don't allow an ID of 0, it is used internally to indicate errors. 23 // Don't allow an ID of 0, it is used internally to indicate errors.
24 DCHECK(dataTypeID); 24 DCHECK(dataTypeID);
25 DCHECK(data); 25 DCHECK(data);
26 26
27 m_serializedData.reserveInitialCapacity(sizeof(uint32_t) + size); 27 m_serializedData.reserveInitialCapacity(sizeof(uint32_t) + size);
28 m_serializedData.append(reinterpret_cast<const char*>(&dataTypeID), 28 m_serializedData.append(reinterpret_cast<const char*>(&dataTypeID),
29 sizeof(uint32_t)); 29 sizeof(uint32_t));
30 m_serializedData.append(data, size); 30 m_serializedData.append(data, size);
31 } 31 }
32 32
33 } // namespace blink 33 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698