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

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: Return DCHECK_IS_ON checks. 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);
72 DCHECK(toWebLocalFrameImpl(frame)->frame());
72 DOMFileSystem* domFileSystem = DOMFileSystem::create(toWebLocalFrameImpl(fra me)->frame()->document(), name, static_cast<FileSystemType>(type), rootURL); 73 DOMFileSystem* domFileSystem = DOMFileSystem::create(toWebLocalFrameImpl(fra me)->frame()->document(), name, static_cast<FileSystemType>(type), rootURL);
73 if (serializableType == SerializableTypeSerializable) 74 if (serializableType == SerializableTypeSerializable)
74 domFileSystem->makeClonable(); 75 domFileSystem->makeClonable();
75 return WebDOMFileSystem(domFileSystem); 76 return WebDOMFileSystem(domFileSystem);
76 } 77 }
77 78
78 void WebDOMFileSystem::reset() 79 void WebDOMFileSystem::reset()
79 { 80 {
80 m_private.reset(); 81 m_private.reset();
81 } 82 }
82 83
83 void WebDOMFileSystem::assign(const WebDOMFileSystem& other) 84 void WebDOMFileSystem::assign(const WebDOMFileSystem& other)
84 { 85 {
85 m_private = other.m_private; 86 m_private = other.m_private;
86 } 87 }
87 88
88 WebString WebDOMFileSystem::name() const 89 WebString WebDOMFileSystem::name() const
89 { 90 {
90 ASSERT(m_private.get()); 91 DCHECK(m_private.get());
91 return m_private->name(); 92 return m_private->name();
92 } 93 }
93 94
94 WebFileSystem::Type WebDOMFileSystem::type() const 95 WebFileSystem::Type WebDOMFileSystem::type() const
95 { 96 {
96 ASSERT(m_private.get()); 97 DCHECK(m_private.get());
97 switch (m_private->type()) { 98 switch (m_private->type()) {
98 case FileSystemTypeTemporary: 99 case FileSystemTypeTemporary:
99 return WebFileSystem::TypeTemporary; 100 return WebFileSystem::TypeTemporary;
100 case FileSystemTypePersistent: 101 case FileSystemTypePersistent:
101 return WebFileSystem::TypePersistent; 102 return WebFileSystem::TypePersistent;
102 case FileSystemTypeIsolated: 103 case FileSystemTypeIsolated:
103 return WebFileSystem::TypeIsolated; 104 return WebFileSystem::TypeIsolated;
104 case FileSystemTypeExternal: 105 case FileSystemTypeExternal:
105 return WebFileSystem::TypeExternal; 106 return WebFileSystem::TypeExternal;
106 default: 107 default:
107 ASSERT_NOT_REACHED(); 108 ASSERT_NOT_REACHED();
108 return WebFileSystem::TypeTemporary; 109 return WebFileSystem::TypeTemporary;
109 } 110 }
110 } 111 }
111 112
112 WebURL WebDOMFileSystem::rootURL() const 113 WebURL WebDOMFileSystem::rootURL() const
113 { 114 {
114 ASSERT(m_private.get()); 115 DCHECK(m_private.get());
115 return m_private->rootURL(); 116 return m_private->rootURL();
116 } 117 }
117 118
118 v8::Local<v8::Value> WebDOMFileSystem::toV8Value(v8::Local<v8::Object> creationC ontext, v8::Isolate* isolate) 119 v8::Local<v8::Value> WebDOMFileSystem::toV8Value(v8::Local<v8::Object> creationC ontext, v8::Isolate* isolate)
119 { 120 {
120 // We no longer use |creationContext| because it's often misused and points 121 // We no longer use |creationContext| because it's often misused and points
121 // to a context faked by user script. 122 // to a context faked by user script.
122 ASSERT(creationContext->CreationContext() == isolate->GetCurrentContext()); 123 DCHECK(creationContext->CreationContext() == isolate->GetCurrentContext());
123 if (!m_private.get()) 124 if (!m_private.get())
124 return v8::Local<v8::Value>(); 125 return v8::Local<v8::Value>();
125 return toV8(m_private.get(), isolate->GetCurrentContext()->Global(), isolate ); 126 return toV8(m_private.get(), isolate->GetCurrentContext()->Global(), isolate );
126 } 127 }
127 128
128 v8::Local<v8::Value> WebDOMFileSystem::createV8Entry( 129 v8::Local<v8::Value> WebDOMFileSystem::createV8Entry(
129 const WebString& path, 130 const WebString& path,
130 EntryType entryType, 131 EntryType entryType,
131 v8::Local<v8::Object> creationContext, 132 v8::Local<v8::Object> creationContext,
132 v8::Isolate* isolate) 133 v8::Isolate* isolate)
133 { 134 {
134 // We no longer use |creationContext| because it's often misused and points 135 // We no longer use |creationContext| because it's often misused and points
135 // to a context faked by user script. 136 // to a context faked by user script.
136 ASSERT(creationContext->CreationContext() == isolate->GetCurrentContext()); 137 DCHECK(creationContext->CreationContext() == isolate->GetCurrentContext());
137 if (!m_private.get()) 138 if (!m_private.get())
138 return v8::Local<v8::Value>(); 139 return v8::Local<v8::Value>();
139 if (entryType == EntryTypeDirectory) 140 if (entryType == EntryTypeDirectory)
140 return toV8(DirectoryEntry::create(m_private.get(), path), isolate->GetC urrentContext()->Global(), isolate); 141 return toV8(DirectoryEntry::create(m_private.get(), path), isolate->GetC urrentContext()->Global(), isolate);
141 ASSERT(entryType == EntryTypeFile); 142 DCHECK_EQ(entryType, EntryTypeFile);
142 return toV8(FileEntry::create(m_private.get(), path), isolate->GetCurrentCon text()->Global(), isolate); 143 return toV8(FileEntry::create(m_private.get(), path), isolate->GetCurrentCon text()->Global(), isolate);
143 } 144 }
144 145
145 WebDOMFileSystem::WebDOMFileSystem(DOMFileSystem* domFileSystem) 146 WebDOMFileSystem::WebDOMFileSystem(DOMFileSystem* domFileSystem)
146 : m_private(domFileSystem) 147 : m_private(domFileSystem)
147 { 148 {
148 } 149 }
149 150
150 WebDOMFileSystem& WebDOMFileSystem::operator=(DOMFileSystem* domFileSystem) 151 WebDOMFileSystem& WebDOMFileSystem::operator=(DOMFileSystem* domFileSystem)
151 { 152 {
152 m_private = domFileSystem; 153 m_private = domFileSystem;
153 return *this; 154 return *this;
154 } 155 }
155 156
156 } // namespace blink 157 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebDOMActivityLogger.cpp ('k') | third_party/WebKit/Source/web/WebDataSourceImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698