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

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: 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(char* data, size_t length)
49 {
50 RefPtr<RawData> raw = RawData::create();
51 raw->mutableData()->appendRange(data, data + length);
jsbell 2015/06/02 19:30:55 could also just be: append(data, length)
dmurph 2015/06/02 20:17:41 Looks better, done.
52 m_private = WebPrivatePtr<RawData>(raw.release().leakRef());
jsbell 2015/06/02 19:30:55 m_private = static_cast<RawData*>( ... ) seems to
dmurph 2015/06/02 20:17:41 I'm confused, I don't see how this would work. I
53 }
54
48 size_t WebThreadSafeData::size() const 55 size_t WebThreadSafeData::size() const
49 { 56 {
50 if (m_private.isNull()) 57 if (m_private.isNull())
51 return 0; 58 return 0;
52 return m_private->length(); 59 return m_private->length();
53 } 60 }
54 61
55 const char* WebThreadSafeData::data() const 62 const char* WebThreadSafeData::data() const
56 { 63 {
57 if (m_private.isNull()) 64 if (m_private.isNull())
58 return 0; 65 return 0;
59 return m_private->data(); 66 return m_private->data();
60 } 67 }
61 68
62 WebThreadSafeData::WebThreadSafeData(const PassRefPtr<RawData>& data) 69 WebThreadSafeData::WebThreadSafeData(const PassRefPtr<RawData>& data)
63 : m_private(data.leakRef()) 70 : m_private(data.leakRef())
64 { 71 {
65 } 72 }
66 73
67 WebThreadSafeData& WebThreadSafeData::operator=(const PassRefPtr<RawData>& data) 74 WebThreadSafeData& WebThreadSafeData::operator=(const PassRefPtr<RawData>& data)
68 { 75 {
69 m_private = data; 76 m_private = data;
70 return *this; 77 return *this;
71 } 78 }
72 79
73 } // namespace blink 80 } // 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