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

Side by Side Diff: Source/platform/exported/WebThreadSafeData.cpp

Issue 1162773003: [Blob] Dependencies for blob storage testing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Simplifications Created 5 years, 6 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 | public/platform/WebBlobData.h » ('j') | public/platform/WebBlobData.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 27 matching lines...) Expand all
38 void WebThreadSafeData::reset() 38 void WebThreadSafeData::reset()
39 { 39 {
40 m_private.reset(); 40 m_private.reset();
41 } 41 }
42 42
43 void WebThreadSafeData::assign(const WebThreadSafeData& other) 43 void WebThreadSafeData::assign(const WebThreadSafeData& other)
44 { 44 {
45 m_private = other.m_private; 45 m_private = other.m_private;
46 } 46 }
47 47
48 void WebThreadSafeData::assign(const char* data, size_t length)
49 {
50 m_private = RawData::create().leakRef();
51 m_private->mutableData()->append(data, length);
52 }
53
48 size_t WebThreadSafeData::size() const 54 size_t WebThreadSafeData::size() const
49 { 55 {
50 if (m_private.isNull()) 56 if (m_private.isNull())
51 return 0; 57 return 0;
52 return m_private->length(); 58 return m_private->length();
53 } 59 }
54 60
55 const char* WebThreadSafeData::data() const 61 const char* WebThreadSafeData::data() const
56 { 62 {
57 if (m_private.isNull()) 63 if (m_private.isNull())
58 return 0; 64 return 0;
59 return m_private->data(); 65 return m_private->data();
60 } 66 }
61 67
62 WebThreadSafeData::WebThreadSafeData(const PassRefPtr<RawData>& data) 68 WebThreadSafeData::WebThreadSafeData(const PassRefPtr<RawData>& data)
63 : m_private(data.leakRef()) 69 : m_private(data.leakRef())
64 { 70 {
65 } 71 }
66 72
67 WebThreadSafeData& WebThreadSafeData::operator=(const PassRefPtr<RawData>& data) 73 WebThreadSafeData& WebThreadSafeData::operator=(const PassRefPtr<RawData>& data)
68 { 74 {
69 m_private = data; 75 m_private = data;
70 return *this; 76 return *this;
71 } 77 }
72 78
73 } // namespace blink 79 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | public/platform/WebBlobData.h » ('j') | public/platform/WebBlobData.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698