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

Side by Side Diff: third_party/WebKit/Source/web/WebDOMFileSystem.cpp

Issue 1839643009: RELEASE_ASSERT -> CHECK and ASSERT -> DCHECK in web. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation. Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include <v8.h> 42 #include <v8.h>
43 43
44 namespace blink { 44 namespace blink {
45 45
46 WebDOMFileSystem WebDOMFileSystem::fromV8Value(v8::Local<v8::Value> value) 46 WebDOMFileSystem WebDOMFileSystem::fromV8Value(v8::Local<v8::Value> value)
47 { 47 {
48 if (!V8DOMFileSystem::hasInstance(value, v8::Isolate::GetCurrent())) 48 if (!V8DOMFileSystem::hasInstance(value, v8::Isolate::GetCurrent()))
49 return WebDOMFileSystem(); 49 return WebDOMFileSystem();
50 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); 50 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value);
51 DOMFileSystem* domFileSystem = V8DOMFileSystem::toImpl(object); 51 DOMFileSystem* domFileSystem = V8DOMFileSystem::toImpl(object);
52 ASSERT(domFileSystem); 52 DCHECK(domFileSystem);
53 return WebDOMFileSystem(domFileSystem); 53 return WebDOMFileSystem(domFileSystem);
54 } 54 }
55 55
56 WebURL WebDOMFileSystem::createFileSystemURL(v8::Local<v8::Value> value) 56 WebURL WebDOMFileSystem::createFileSystemURL(v8::Local<v8::Value> value)
57 { 57 {
58 const Entry* const entry = V8Entry::toImplWithTypeCheck(v8::Isolate::GetCurr ent(), value); 58 const Entry* const entry = V8Entry::toImplWithTypeCheck(v8::Isolate::GetCurr ent(), value);
59 if (entry) 59 if (entry)
60 return entry->filesystem()->createFileSystemURL(entry); 60 return entry->filesystem()->createFileSystemURL(entry);
61 return WebURL(); 61 return WebURL();
62 } 62 }
63 63
64 WebDOMFileSystem WebDOMFileSystem::create( 64 WebDOMFileSystem WebDOMFileSystem::create(
65 WebLocalFrame* frame, 65 WebLocalFrame* frame,
66 WebFileSystemType type, 66 WebFileSystemType type,
67 const WebString& name, 67 const WebString& name,
68 const WebURL& rootURL, 68 const WebURL& rootURL,
69 SerializableType serializableType) 69 SerializableType serializableType)
70 { 70 {
71 ASSERT(frame && toWebLocalFrameImpl(frame)->frame()); 71 DCHECK(frame && toWebLocalFrameImpl(frame)->frame());
tkent 2016/03/31 23:05:21 Please split this into two. DCHECK(frame);
72 DOMFileSystem* domFileSystem = DOMFileSystem::create(toWebLocalFrameImpl(fra me)->frame()->document(), name, static_cast<FileSystemType>(type), rootURL); 72 DOMFileSystem* domFileSystem = DOMFileSystem::create(toWebLocalFrameImpl(fra me)->frame()->document(), name, static_cast<FileSystemType>(type), rootURL);
73 if (serializableType == SerializableTypeSerializable) 73 if (serializableType == SerializableTypeSerializable)
74 domFileSystem->makeClonable(); 74 domFileSystem->makeClonable();
75 return WebDOMFileSystem(domFileSystem); 75 return WebDOMFileSystem(domFileSystem);
76 } 76 }
77 77
78 void WebDOMFileSystem::reset() 78 void WebDOMFileSystem::reset()
79 { 79 {
80 m_private.reset(); 80 m_private.reset();
81 } 81 }
82 82
83 void WebDOMFileSystem::assign(const WebDOMFileSystem& other) 83 void WebDOMFileSystem::assign(const WebDOMFileSystem& other)
84 { 84 {
85 m_private = other.m_private; 85 m_private = other.m_private;
86 } 86 }
87 87
88 WebString WebDOMFileSystem::name() const 88 WebString WebDOMFileSystem::name() const
89 { 89 {
90 ASSERT(m_private.get()); 90 DCHECK(m_private.get());
91 return m_private->name(); 91 return m_private->name();
92 } 92 }
93 93
94 WebFileSystem::Type WebDOMFileSystem::type() const 94 WebFileSystem::Type WebDOMFileSystem::type() const
95 { 95 {
96 ASSERT(m_private.get()); 96 DCHECK(m_private.get());
97 switch (m_private->type()) { 97 switch (m_private->type()) {
98 case FileSystemTypeTemporary: 98 case FileSystemTypeTemporary:
99 return WebFileSystem::TypeTemporary; 99 return WebFileSystem::TypeTemporary;
100 case FileSystemTypePersistent: 100 case FileSystemTypePersistent:
101 return WebFileSystem::TypePersistent; 101 return WebFileSystem::TypePersistent;
102 case FileSystemTypeIsolated: 102 case FileSystemTypeIsolated:
103 return WebFileSystem::TypeIsolated; 103 return WebFileSystem::TypeIsolated;
104 case FileSystemTypeExternal: 104 case FileSystemTypeExternal:
105 return WebFileSystem::TypeExternal; 105 return WebFileSystem::TypeExternal;
106 default: 106 default:
107 ASSERT_NOT_REACHED(); 107 ASSERT_NOT_REACHED();
108 return WebFileSystem::TypeTemporary; 108 return WebFileSystem::TypeTemporary;
109 } 109 }
110 } 110 }
111 111
112 WebURL WebDOMFileSystem::rootURL() const 112 WebURL WebDOMFileSystem::rootURL() const
113 { 113 {
114 ASSERT(m_private.get()); 114 DCHECK(m_private.get());
115 return m_private->rootURL(); 115 return m_private->rootURL();
116 } 116 }
117 117
118 v8::Local<v8::Value> WebDOMFileSystem::toV8Value(v8::Local<v8::Object> creationC ontext, v8::Isolate* isolate) 118 v8::Local<v8::Value> WebDOMFileSystem::toV8Value(v8::Local<v8::Object> creationC ontext, v8::Isolate* isolate)
119 { 119 {
120 // We no longer use |creationContext| because it's often misused and points 120 // We no longer use |creationContext| because it's often misused and points
121 // to a context faked by user script. 121 // to a context faked by user script.
122 ASSERT(creationContext->CreationContext() == isolate->GetCurrentContext()); 122 DCHECK(creationContext->CreationContext() == isolate->GetCurrentContext());
123 if (!m_private.get()) 123 if (!m_private.get())
124 return v8::Local<v8::Value>(); 124 return v8::Local<v8::Value>();
125 return toV8(m_private.get(), isolate->GetCurrentContext()->Global(), isolate ); 125 return toV8(m_private.get(), isolate->GetCurrentContext()->Global(), isolate );
126 } 126 }
127 127
128 v8::Local<v8::Value> WebDOMFileSystem::createV8Entry( 128 v8::Local<v8::Value> WebDOMFileSystem::createV8Entry(
129 const WebString& path, 129 const WebString& path,
130 EntryType entryType, 130 EntryType entryType,
131 v8::Local<v8::Object> creationContext, 131 v8::Local<v8::Object> creationContext,
132 v8::Isolate* isolate) 132 v8::Isolate* isolate)
133 { 133 {
134 // We no longer use |creationContext| because it's often misused and points 134 // We no longer use |creationContext| because it's often misused and points
135 // to a context faked by user script. 135 // to a context faked by user script.
136 ASSERT(creationContext->CreationContext() == isolate->GetCurrentContext()); 136 DCHECK(creationContext->CreationContext() == isolate->GetCurrentContext());
137 if (!m_private.get()) 137 if (!m_private.get())
138 return v8::Local<v8::Value>(); 138 return v8::Local<v8::Value>();
139 if (entryType == EntryTypeDirectory) 139 if (entryType == EntryTypeDirectory)
140 return toV8(DirectoryEntry::create(m_private.get(), path), isolate->GetC urrentContext()->Global(), isolate); 140 return toV8(DirectoryEntry::create(m_private.get(), path), isolate->GetC urrentContext()->Global(), isolate);
141 ASSERT(entryType == EntryTypeFile); 141 DCHECK_EQ(entryType, EntryTypeFile);
142 return toV8(FileEntry::create(m_private.get(), path), isolate->GetCurrentCon text()->Global(), isolate); 142 return toV8(FileEntry::create(m_private.get(), path), isolate->GetCurrentCon text()->Global(), isolate);
143 } 143 }
144 144
145 WebDOMFileSystem::WebDOMFileSystem(DOMFileSystem* domFileSystem) 145 WebDOMFileSystem::WebDOMFileSystem(DOMFileSystem* domFileSystem)
146 : m_private(domFileSystem) 146 : m_private(domFileSystem)
147 { 147 {
148 } 148 }
149 149
150 WebDOMFileSystem& WebDOMFileSystem::operator=(DOMFileSystem* domFileSystem) 150 WebDOMFileSystem& WebDOMFileSystem::operator=(DOMFileSystem* domFileSystem)
151 { 151 {
152 m_private = domFileSystem; 152 m_private = domFileSystem;
153 return *this; 153 return *this;
154 } 154 }
155 155
156 } // namespace blink 156 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698