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

Side by Side Diff: content/renderer/dom_storage/webstoragenamespace_impl.cc

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/webstoragenamespace_impl.h" 5 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/dom_storage/dom_storage_types.h" 8 #include "content/common/dom_storage/dom_storage_types.h"
9 #include "content/renderer/dom_storage/webstoragearea_impl.h" 9 #include "content/renderer/dom_storage/webstoragearea_impl.h"
10 #include "third_party/WebKit/public/platform/URLConversion.h"
10 #include "third_party/WebKit/public/platform/WebString.h" 11 #include "third_party/WebKit/public/platform/WebString.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 using blink::WebStorageArea; 14 using blink::WebStorageArea;
14 using blink::WebStorageNamespace; 15 using blink::WebStorageNamespace;
15 using blink::WebString; 16 using blink::WebString;
16 17
17 namespace content { 18 namespace content {
18 19
19 WebStorageNamespaceImpl::WebStorageNamespaceImpl() 20 WebStorageNamespaceImpl::WebStorageNamespaceImpl()
20 : namespace_id_(kLocalStorageNamespaceId) { 21 : namespace_id_(kLocalStorageNamespaceId) {
21 } 22 }
22 23
23 WebStorageNamespaceImpl::WebStorageNamespaceImpl(int64_t namespace_id) 24 WebStorageNamespaceImpl::WebStorageNamespaceImpl(int64_t namespace_id)
24 : namespace_id_(namespace_id) { 25 : namespace_id_(namespace_id) {
25 DCHECK_NE(kInvalidSessionStorageNamespaceId, namespace_id); 26 DCHECK_NE(kInvalidSessionStorageNamespaceId, namespace_id);
26 } 27 }
27 28
28 WebStorageNamespaceImpl::~WebStorageNamespaceImpl() { 29 WebStorageNamespaceImpl::~WebStorageNamespaceImpl() {
29 } 30 }
30 31
31 WebStorageArea* WebStorageNamespaceImpl::createStorageArea( 32 WebStorageArea* WebStorageNamespaceImpl::createStorageArea(
32 const WebString& origin) { 33 const WebString& origin) {
33 return new WebStorageAreaImpl(namespace_id_, GURL(origin)); 34 return new WebStorageAreaImpl(namespace_id_, blink::WebStringToGURL(origin));
34 } 35 }
35 36
36 WebStorageNamespace* WebStorageNamespaceImpl::copy() { 37 WebStorageNamespace* WebStorageNamespaceImpl::copy() {
37 // By returning NULL, we're telling WebKit to lazily fetch it the next time 38 // By returning NULL, we're telling WebKit to lazily fetch it the next time
38 // session storage is used. In the WebViewClient::createView, we do the 39 // session storage is used. In the WebViewClient::createView, we do the
39 // book-keeping necessary to make it a true copy-on-write despite not doing 40 // book-keeping necessary to make it a true copy-on-write despite not doing
40 // anything here, now. 41 // anything here, now.
41 return NULL; 42 return NULL;
42 } 43 }
43 44
44 bool WebStorageNamespaceImpl::isSameNamespace( 45 bool WebStorageNamespaceImpl::isSameNamespace(
45 const WebStorageNamespace& other) const { 46 const WebStorageNamespace& other) const {
46 const WebStorageNamespaceImpl* other_impl = 47 const WebStorageNamespaceImpl* other_impl =
47 static_cast<const WebStorageNamespaceImpl*>(&other); 48 static_cast<const WebStorageNamespaceImpl*>(&other);
48 return namespace_id_ == other_impl->namespace_id_; 49 return namespace_id_ == other_impl->namespace_id_;
49 } 50 }
50 51
51 } // namespace content 52 } // namespace content
OLDNEW
« no previous file with comments | « content/child/notifications/notification_manager.cc ('k') | content/renderer/drop_data_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698