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

Side by Side Diff: third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.cpp

Issue 2812473002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in modules/quota (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/quota/StorageManager.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 namespace blink { 50 namespace blink {
51 51
52 DeprecatedStorageQuota::DeprecatedStorageQuota(Type type) : type_(type) {} 52 DeprecatedStorageQuota::DeprecatedStorageQuota(Type type) : type_(type) {}
53 53
54 void DeprecatedStorageQuota::queryUsageAndQuota( 54 void DeprecatedStorageQuota::queryUsageAndQuota(
55 ScriptState* script_state, 55 ScriptState* script_state,
56 StorageUsageCallback* success_callback, 56 StorageUsageCallback* success_callback,
57 StorageErrorCallback* error_callback) { 57 StorageErrorCallback* error_callback) {
58 ExecutionContext* execution_context = script_state->GetExecutionContext(); 58 ExecutionContext* execution_context = script_state->GetExecutionContext();
59 ASSERT(execution_context); 59 DCHECK(execution_context);
60 60
61 WebStorageQuotaType storage_type = static_cast<WebStorageQuotaType>(type_); 61 WebStorageQuotaType storage_type = static_cast<WebStorageQuotaType>(type_);
62 if (storage_type != kWebStorageQuotaTypeTemporary && 62 if (storage_type != kWebStorageQuotaTypeTemporary &&
63 storage_type != kWebStorageQuotaTypePersistent) { 63 storage_type != kWebStorageQuotaTypePersistent) {
64 // Unknown storage type is requested. 64 // Unknown storage type is requested.
65 TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state) 65 TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state)
66 ->PostTask(BLINK_FROM_HERE, StorageErrorCallback::CreateSameThreadTask( 66 ->PostTask(BLINK_FROM_HERE, StorageErrorCallback::CreateSameThreadTask(
67 error_callback, kNotSupportedError)); 67 error_callback, kNotSupportedError));
68 return; 68 return;
69 } 69 }
(...skipping 13 matching lines...) Expand all
83 Platform::Current()->QueryStorageUsageAndQuota(storage_partition, 83 Platform::Current()->QueryStorageUsageAndQuota(storage_partition,
84 storage_type, callbacks); 84 storage_type, callbacks);
85 } 85 }
86 86
87 void DeprecatedStorageQuota::requestQuota( 87 void DeprecatedStorageQuota::requestQuota(
88 ScriptState* script_state, 88 ScriptState* script_state,
89 unsigned long long new_quota_in_bytes, 89 unsigned long long new_quota_in_bytes,
90 StorageQuotaCallback* success_callback, 90 StorageQuotaCallback* success_callback,
91 StorageErrorCallback* error_callback) { 91 StorageErrorCallback* error_callback) {
92 ExecutionContext* execution_context = script_state->GetExecutionContext(); 92 ExecutionContext* execution_context = script_state->GetExecutionContext();
93 ASSERT(execution_context); 93 DCHECK(execution_context);
94 94
95 WebStorageQuotaType storage_type = static_cast<WebStorageQuotaType>(type_); 95 WebStorageQuotaType storage_type = static_cast<WebStorageQuotaType>(type_);
96 if (storage_type != kWebStorageQuotaTypeTemporary && 96 if (storage_type != kWebStorageQuotaTypeTemporary &&
97 storage_type != kWebStorageQuotaTypePersistent) { 97 storage_type != kWebStorageQuotaTypePersistent) {
98 // Unknown storage type is requested. 98 // Unknown storage type is requested.
99 TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state) 99 TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state)
100 ->PostTask(BLINK_FROM_HERE, StorageErrorCallback::CreateSameThreadTask( 100 ->PostTask(BLINK_FROM_HERE, StorageErrorCallback::CreateSameThreadTask(
101 error_callback, kNotSupportedError)); 101 error_callback, kNotSupportedError));
102 return; 102 return;
103 } 103 }
104 104
105 StorageQuotaClient* client = StorageQuotaClient::From(execution_context); 105 StorageQuotaClient* client = StorageQuotaClient::From(execution_context);
106 if (!client) { 106 if (!client) {
107 TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state) 107 TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state)
108 ->PostTask(BLINK_FROM_HERE, StorageErrorCallback::CreateSameThreadTask( 108 ->PostTask(BLINK_FROM_HERE, StorageErrorCallback::CreateSameThreadTask(
109 error_callback, kNotSupportedError)); 109 error_callback, kNotSupportedError));
110 return; 110 return;
111 } 111 }
112 112
113 client->RequestQuota(script_state, storage_type, new_quota_in_bytes, 113 client->RequestQuota(script_state, storage_type, new_quota_in_bytes,
114 success_callback, error_callback); 114 success_callback, error_callback);
115 } 115 }
116 116
117 } // namespace blink 117 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/quota/StorageManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698