summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/blob/serialized_blob_struct_traits.cc
blob: 50bdc957a44e819a3e366c4703a40775b3a1284e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/platform/blob/serialized_blob_struct_traits.h"

namespace mojo {

bool StructTraits<blink::mojom::blink::SerializedBlob::DataView,
                  scoped_refptr<blink::BlobDataHandle>>::
    Read(blink::mojom::blink::SerializedBlob::DataView data,
         scoped_refptr<blink::BlobDataHandle>* out) {
  WTF::String uuid;
  WTF::String type;
  if (!data.ReadUuid(&uuid) || !data.ReadContentType(&type))
    return false;
  *out = blink::BlobDataHandle::Create(
      uuid, type, data.size(),
      data.TakeBlob<blink::mojom::blink::BlobPtrInfo>());
  return true;
}

}  // namespace mojo