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

Side by Side Diff: Source/core/storage/Storage.cpp

Issue 106853005: Implement platform deleters per spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch to DeleteResult enum + extend scheme to indexed deleters Created 7 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 { 71 {
72 setItem(name, value, exceptionState); 72 setItem(name, value, exceptionState);
73 return true; 73 return true;
74 } 74 }
75 75
76 bool Storage::anonymousIndexedSetter(unsigned index, const AtomicString& value, ExceptionState& exceptionState) 76 bool Storage::anonymousIndexedSetter(unsigned index, const AtomicString& value, ExceptionState& exceptionState)
77 { 77 {
78 return anonymousNamedSetter(AtomicString::number(index), value, exceptionSta te); 78 return anonymousNamedSetter(AtomicString::number(index), value, exceptionSta te);
79 } 79 }
80 80
81 bool Storage::anonymousNamedDeleter(const AtomicString& name, ExceptionState& ex ceptionState) 81 DeleteResult Storage::anonymousNamedDeleter(const AtomicString& name, ExceptionS tate& exceptionState)
82 { 82 {
83 bool found = contains(name, exceptionState); 83 bool found = contains(name, exceptionState);
84 if (!found || exceptionState.hadException()) 84 if (!found)
85 return false; 85 return DeleteUnknownProperty;
86 if (exceptionState.hadException())
87 return DeleteReject;
86 removeItem(name, exceptionState); 88 removeItem(name, exceptionState);
87 if (exceptionState.hadException()) 89 if (exceptionState.hadException())
88 return false; 90 return DeleteReject;
89 return true; 91 return DeleteSuccess;
90 } 92 }
91 93
92 bool Storage::anonymousIndexedDeleter(unsigned index, ExceptionState& exceptionS tate) 94 DeleteResult Storage::anonymousIndexedDeleter(unsigned index, ExceptionState& ex ceptionState)
93 { 95 {
94 return anonymousNamedDeleter(AtomicString::number(index), exceptionState); 96 DeleteResult result = anonymousNamedDeleter(AtomicString::number(index), exc eptionState);
97 return result == DeleteUnknownProperty ? DeleteSuccess : result;
95 } 98 }
96 99
97 void Storage::namedPropertyEnumerator(Vector<String>& names, ExceptionState& exc eptionState) 100 void Storage::namedPropertyEnumerator(Vector<String>& names, ExceptionState& exc eptionState)
98 { 101 {
99 unsigned length = this->length(exceptionState); 102 unsigned length = this->length(exceptionState);
100 if (exceptionState.hadException()) 103 if (exceptionState.hadException())
101 return; 104 return;
102 names.resize(length); 105 names.resize(length);
103 for (unsigned i = 0; i < length; ++i) { 106 for (unsigned i = 0; i < length; ++i) {
104 String key = this->key(i, exceptionState); 107 String key = this->key(i, exceptionState);
(...skipping 11 matching lines...) Expand all
116 { 119 {
117 if (name == "length") 120 if (name == "length")
118 return false; 121 return false;
119 bool found = contains(name, exceptionState); 122 bool found = contains(name, exceptionState);
120 if (exceptionState.hadException() || !found) 123 if (exceptionState.hadException() || !found)
121 return false; 124 return false;
122 return true; 125 return true;
123 } 126 }
124 127
125 } 128 }
OLDNEW
« Source/bindings/scripts/code_generator_v8.pm ('K') | « Source/core/storage/Storage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698