Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/dom_storage/local_storage_area.h" | 5 #include "content/renderer/dom_storage/local_storage_area.h" |
| 6 | 6 |
| 7 #include "content/common/storage_partition_service.mojom.h" | 7 #include "third_party/WebKit/public/platform/WebURL.h" |
| 8 | 8 |
| 9 using blink::WebString; | 9 using blink::WebString; |
| 10 using blink::WebURL; | 10 using blink::WebURL; |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 LocalStorageArea::LocalStorageArea( | 14 LocalStorageArea::LocalStorageArea( |
| 15 const url::Origin& origin, | 15 scoped_refptr<LocalStorageCachedArea> cached_area) |
| 16 StoragePartitionService* storage_partition_service) | 16 : cached_area_(cached_area) { |
|
michaeln
2016/03/01 01:38:48
would std::move(cached_area) make a difference her
jam
2016/03/01 06:50:53
I haven't seen that as the standard, i think it's
michaeln
2016/03/01 21:38:44
It's a practical question, do you know if as coded
jam
2016/03/02 06:21:20
yep it'll do an extra refcount. thinking more abou
| |
| 17 : origin_(origin), binding_(this) { | |
| 18 storage_partition_service->OpenLocalStorage( | |
| 19 origin_.Serialize(), binding_.CreateInterfacePtrAndBind(), | |
| 20 mojo::GetProxy(&leveldb_)); | |
| 21 } | 17 } |
| 22 | 18 |
| 23 LocalStorageArea::~LocalStorageArea() { | 19 LocalStorageArea::~LocalStorageArea() { |
| 24 } | 20 } |
| 25 | 21 |
| 26 unsigned LocalStorageArea::length() { | 22 unsigned LocalStorageArea::length() { |
| 27 return 0u; | 23 return cached_area_->GetLength(); |
| 28 } | 24 } |
| 29 | 25 |
| 30 WebString LocalStorageArea::key(unsigned index) { | 26 WebString LocalStorageArea::key(unsigned index) { |
| 31 return WebString(); | 27 return cached_area_->GetKey(index); |
| 32 } | 28 } |
| 33 | 29 |
| 34 WebString LocalStorageArea::getItem(const WebString& key) { | 30 WebString LocalStorageArea::getItem(const WebString& key) { |
| 35 return WebString(); | 31 return cached_area_->GetItem(key); |
| 36 } | 32 } |
| 37 | 33 |
| 38 void LocalStorageArea::setItem( | 34 void LocalStorageArea::setItem( |
| 39 const WebString& key, const WebString& value, const WebURL& page_url, | 35 const WebString& key, const WebString& value, const WebURL& page_url, |
| 40 WebStorageArea::Result& result) { | 36 WebStorageArea::Result& result) { |
| 37 if (!cached_area_->SetItem(key, value, page_url)) | |
| 38 result = ResultBlockedByQuota; | |
| 39 else | |
| 40 result = ResultOK; | |
| 41 } | 41 } |
| 42 | 42 |
| 43 void LocalStorageArea::removeItem( | 43 void LocalStorageArea::removeItem( |
| 44 const WebString& key, const WebURL& page_url) { | 44 const WebString& key, const WebURL& page_url) { |
| 45 cached_area_->RemoveItem(key, page_url); | |
| 45 } | 46 } |
| 46 | 47 |
| 47 void LocalStorageArea::clear(const WebURL& page_url) { | 48 void LocalStorageArea::clear(const WebURL& page_url) { |
| 48 } | 49 } |
| 49 | 50 |
| 50 void LocalStorageArea::KeyChanged(mojo::Array<uint8_t> key, | |
| 51 mojo::Array<uint8_t> new_value, | |
| 52 mojo::Array<uint8_t> old_value, | |
| 53 const mojo::String& source) { | |
| 54 } | |
| 55 | |
| 56 void LocalStorageArea::KeyDeleted(mojo::Array<uint8_t> key, | |
| 57 const mojo::String& source) { | |
| 58 } | |
| 59 | |
| 60 void LocalStorageArea::AllDeleted(const mojo::String& source) { | |
| 61 } | |
| 62 | |
| 63 } // namespace content | 51 } // namespace content |
| OLD | NEW |