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

Side by Side Diff: Source/core/css/CSSPrimitiveValue.h

Issue 1233363002: CSSValue Immediates: Replace CSSPrimitiveValue usage with const references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_4_attempt_2
Patch Set: Rebase Created 5 years, 4 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/core/css/CSSGradientValue.cpp ('k') | Source/core/css/CSSProperty.h » ('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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 : m_rawValue(const_cast<CSSLargePrimitiveValue*>(object)) 392 : m_rawValue(const_cast<CSSLargePrimitiveValue*>(object))
393 { 393 {
394 ref(); 394 ref();
395 } 395 }
396 396
397 CSSPrimitiveValue(PassRefPtrWillBeRawPtr<CSSLargePrimitiveValue> cssValue) 397 CSSPrimitiveValue(PassRefPtrWillBeRawPtr<CSSLargePrimitiveValue> cssValue)
398 : m_rawValue(cssValue.leakRef()) 398 : m_rawValue(cssValue.leakRef())
399 { 399 {
400 } 400 }
401 401
402 /*
403 CSSPrimitiveValue(const CSSPrimitiveValue& other)
404 : m_rawValue(other.m_rawValue.asPtr)
405 {
406 ref();
407 }*/
402 408
403 CSSPrimitiveValue(const CSSPrimitiveValue& other) 409 CSSPrimitiveValue(CSSPrimitiveValue const& other)
404 : m_rawValue(other.m_rawValue.asPtr) 410 : m_rawValue(other.m_rawValue.asPtr)
405 { 411 {
406 ref(); 412 ref();
407 } 413 }
408 414
409 CSSPrimitiveValue& operator=(const CSSPrimitiveValue& rhs) 415 CSSPrimitiveValue(CSSPrimitiveValue&& other)
416 : m_rawValue(other.m_rawValue.asPtr)
417 {
418 other.m_rawValue.asPtr.clear();
419 }
420
421 CSSPrimitiveValue& operator=(CSSPrimitiveValue const& rhs)
410 { 422 {
411 rhs.ref(); 423 rhs.ref();
412 deref(); 424 deref();
413 m_rawValue = rhs.m_rawValue; 425 m_rawValue = rhs.m_rawValue;
414 return *this; 426 return *this;
415 } 427 }
416 428
429 CSSPrimitiveValue& operator=(CSSPrimitiveValue&& rhs)
430 {
431 return *this;
432 }
433
417 ~CSSPrimitiveValue() 434 ~CSSPrimitiveValue()
418 { 435 {
419 deref(); 436 if (m_rawValue.asPtr)
437 deref();
420 } 438 }
421 439
422 440
423 CSSLargePrimitiveValue* get() const 441 CSSLargePrimitiveValue* get() const
424 { 442 {
425 return m_rawValue.asPtr; 443 return m_rawValue.asPtr;
426 } 444 }
427 445
428 void accumulateLengthArray(CSSLengthArray&, double multiplier = 1) const; 446 void accumulateLengthArray(CSSLengthArray&, double multiplier = 1) const;
429 void accumulateLengthArray(CSSLengthArray&, CSSLengthTypeArray&, double mult iplier = 1) const; 447 void accumulateLengthArray(CSSLengthArray&, CSSLengthTypeArray&, double mult iplier = 1) const;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 }; 699 };
682 700
683 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; 701 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray;
684 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; 702 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray;
685 703
686 static_assert(sizeof(CSSPrimitiveValue) == sizeof(void*), "CSSPrimitiveValue mus t be the size of a pointer"); 704 static_assert(sizeof(CSSPrimitiveValue) == sizeof(void*), "CSSPrimitiveValue mus t be the size of a pointer");
687 705
688 } // namespace blink 706 } // namespace blink
689 707
690 #endif // CSSPrimitiveValue_h 708 #endif // CSSPrimitiveValue_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSGradientValue.cpp ('k') | Source/core/css/CSSProperty.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698