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

Side by Side Diff: Source/platform/weborigin/KURL.cpp

Issue 297223005: Add a move constructor and move assignment operator to KURL (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Stop using std::move Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/weborigin/KURL.h ('k') | no next file » | 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) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
4 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 m_protocolIsInHTTPFamily = other.m_protocolIsInHTTPFamily; 248 m_protocolIsInHTTPFamily = other.m_protocolIsInHTTPFamily;
249 m_parsed = other.m_parsed; 249 m_parsed = other.m_parsed;
250 m_string = other.m_string; 250 m_string = other.m_string;
251 if (other.m_innerURL) 251 if (other.m_innerURL)
252 m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy())); 252 m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy()));
253 else 253 else
254 m_innerURL.clear(); 254 m_innerURL.clear();
255 return *this; 255 return *this;
256 } 256 }
257 257
258 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
259 KURL::KURL(KURL&& other)
260 : m_isValid(other.m_isValid)
261 , m_protocolIsInHTTPFamily(other.m_protocolIsInHTTPFamily)
262 , m_parsed(other.m_parsed)
263 , m_string(static_cast<String&&>(other.m_string))
tkent 2014/05/27 00:19:16 Would you add FIXME about std::move please?
Inactive 2014/05/27 00:30:00 Done.
264 , m_innerURL(other.m_innerURL.release())
265 {
266 }
267
268 KURL& KURL::operator=(KURL&& other)
269 {
270 m_isValid = other.m_isValid;
271 m_protocolIsInHTTPFamily = other.m_protocolIsInHTTPFamily;
272 m_parsed = other.m_parsed;
273 m_string = static_cast<String&&>(other.m_string);
tkent 2014/05/27 00:19:16 Ditto.
Inactive 2014/05/27 00:30:00 Done.
274 m_innerURL = other.m_innerURL.release();
275 return *this;
276 }
277 #endif
278
258 KURL KURL::copy() const 279 KURL KURL::copy() const
259 { 280 {
260 KURL result; 281 KURL result;
261 result.m_isValid = m_isValid; 282 result.m_isValid = m_isValid;
262 result.m_protocolIsInHTTPFamily = m_protocolIsInHTTPFamily; 283 result.m_protocolIsInHTTPFamily = m_protocolIsInHTTPFamily;
263 result.m_parsed = m_parsed; 284 result.m_parsed = m_parsed;
264 result.m_string = m_string.isolatedCopy(); 285 result.m_string = m_string.isolatedCopy();
265 if (m_innerURL) 286 if (m_innerURL)
266 result.m_innerURL = adoptPtr(new KURL(m_innerURL->copy())); 287 result.m_innerURL = adoptPtr(new KURL(m_innerURL->copy()));
267 return result; 288 return result;
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 m_string = AtomicString::fromUTF8(output.data(), output.length()); 903 m_string = AtomicString::fromUTF8(output.data(), output.length());
883 } 904 }
884 905
885 bool KURL::isSafeToSendToAnotherThread() const 906 bool KURL::isSafeToSendToAnotherThread() const
886 { 907 {
887 return m_string.isSafeToSendToAnotherThread() 908 return m_string.isSafeToSendToAnotherThread()
888 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread()); 909 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread());
889 } 910 }
890 911
891 } // namespace WebCore 912 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/weborigin/KURL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698