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

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: Add FIXME comment Created 6 years, 7 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 // FIXME: Instead of explicitly casting to String&& here, we should use std: :move, but that requires us to
264 // have a standard library that supports move semantics.
265 , m_string(static_cast<String&&>(other.m_string))
266 , m_innerURL(other.m_innerURL.release())
267 {
268 }
269
270 KURL& KURL::operator=(KURL&& other)
271 {
272 m_isValid = other.m_isValid;
273 m_protocolIsInHTTPFamily = other.m_protocolIsInHTTPFamily;
274 m_parsed = other.m_parsed;
275 // FIXME: Instead of explicitly casting to String&& here, we should use std: :move, but that requires us to
276 // have a standard library that supports move semantics.
277 m_string = static_cast<String&&>(other.m_string);
278 m_innerURL = other.m_innerURL.release();
279 return *this;
280 }
281 #endif
282
258 KURL KURL::copy() const 283 KURL KURL::copy() const
259 { 284 {
260 KURL result; 285 KURL result;
261 result.m_isValid = m_isValid; 286 result.m_isValid = m_isValid;
262 result.m_protocolIsInHTTPFamily = m_protocolIsInHTTPFamily; 287 result.m_protocolIsInHTTPFamily = m_protocolIsInHTTPFamily;
263 result.m_parsed = m_parsed; 288 result.m_parsed = m_parsed;
264 result.m_string = m_string.isolatedCopy(); 289 result.m_string = m_string.isolatedCopy();
265 if (m_innerURL) 290 if (m_innerURL)
266 result.m_innerURL = adoptPtr(new KURL(m_innerURL->copy())); 291 result.m_innerURL = adoptPtr(new KURL(m_innerURL->copy()));
267 return result; 292 return result;
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 m_string = AtomicString::fromUTF8(output.data(), output.length()); 907 m_string = AtomicString::fromUTF8(output.data(), output.length());
883 } 908 }
884 909
885 bool KURL::isSafeToSendToAnotherThread() const 910 bool KURL::isSafeToSendToAnotherThread() const
886 { 911 {
887 return m_string.isSafeToSendToAnotherThread() 912 return m_string.isSafeToSendToAnotherThread()
888 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread()); 913 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread());
889 } 914 }
890 915
891 } // namespace WebCore 916 } // 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