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

Side by Side Diff: Source/platform/graphics/ThreadSafeDataTransport.cpp

Issue 150653006: Remove the Vector::append overload that takes a Vector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 10 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 | « Source/platform/graphics/GraphicsLayer.cpp ('k') | Source/platform/network/FormDataBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ASSERT(buffer->size() >= m_readPosition); 47 ASSERT(buffer->size() >= m_readPosition);
48 Vector<RefPtr<SharedBuffer> > newBufferQueue; 48 Vector<RefPtr<SharedBuffer> > newBufferQueue;
49 49
50 const char* segment = 0; 50 const char* segment = 0;
51 while (size_t length = buffer->getSomeData(segment, m_readPosition)) { 51 while (size_t length = buffer->getSomeData(segment, m_readPosition)) {
52 m_readPosition += length; 52 m_readPosition += length;
53 newBufferQueue.append(SharedBuffer::create(segment, length)); 53 newBufferQueue.append(SharedBuffer::create(segment, length));
54 } 54 }
55 55
56 MutexLocker locker(m_mutex); 56 MutexLocker locker(m_mutex);
57 m_newBufferQueue.append(newBufferQueue); 57 m_newBufferQueue.appendVector(newBufferQueue);
58 m_allDataReceived = allDataReceived; 58 m_allDataReceived = allDataReceived;
59 } 59 }
60 60
61 void ThreadSafeDataTransport::data(SharedBuffer** buffer, bool* allDataReceived) 61 void ThreadSafeDataTransport::data(SharedBuffer** buffer, bool* allDataReceived)
62 { 62 {
63 Vector<RefPtr<SharedBuffer> > newBufferQueue; 63 Vector<RefPtr<SharedBuffer> > newBufferQueue;
64 { 64 {
65 MutexLocker lock(m_mutex); 65 MutexLocker lock(m_mutex);
66 m_newBufferQueue.swap(newBufferQueue); 66 m_newBufferQueue.swap(newBufferQueue);
67 } 67 }
68 for (size_t i = 0; i < newBufferQueue.size(); ++i) 68 for (size_t i = 0; i < newBufferQueue.size(); ++i)
69 m_readBuffer->append(newBufferQueue[i].get()); 69 m_readBuffer->append(newBufferQueue[i].get());
70 ASSERT(buffer); 70 ASSERT(buffer);
71 ASSERT(allDataReceived); 71 ASSERT(allDataReceived);
72 *buffer = m_readBuffer.get(); 72 *buffer = m_readBuffer.get();
73 *allDataReceived = m_allDataReceived; 73 *allDataReceived = m_allDataReceived;
74 } 74 }
75 75
76 bool ThreadSafeDataTransport::hasNewData() 76 bool ThreadSafeDataTransport::hasNewData()
77 { 77 {
78 MutexLocker lock(m_mutex); 78 MutexLocker lock(m_mutex);
79 return !m_newBufferQueue.isEmpty(); 79 return !m_newBufferQueue.isEmpty();
80 } 80 }
81 81
82 } // namespace WebCore 82 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsLayer.cpp ('k') | Source/platform/network/FormDataBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698