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

Unified Diff: third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp

Issue 1381353002: Revert of permissions: remove duplicates from request multiple at the Blink level (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-permissions
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/permissions/PermissionsCallback.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp
diff --git a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp
index 186d772b3902ce8027cf8304981d71e0dce049e0..1ea7d2c1f76064209ff43d4722b6faaa29a4f226 100644
--- a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp
+++ b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp
@@ -10,10 +10,9 @@
namespace blink {
-PermissionsCallback::PermissionsCallback(ScriptPromiseResolver* resolver, PassOwnPtr<Vector<WebPermissionType>> internalPermissions, PassOwnPtr<Vector<int>> callerIndexToInternalIndex)
+PermissionsCallback::PermissionsCallback(ScriptPromiseResolver* resolver, PassOwnPtr<WebVector<WebPermissionType>> permission_types)
: m_resolver(resolver),
- m_internalPermissions(internalPermissions),
- m_callerIndexToInternalIndex(callerIndexToInternalIndex)
+ m_permissionTypes(permission_types)
{
ASSERT(m_resolver);
}
@@ -24,16 +23,13 @@
return;
OwnPtr<WebVector<WebPermissionStatus>> statusPtr = permissionStatus.release();
- Vector<PermissionStatus*> result(m_callerIndexToInternalIndex->size());
- // Create the response vector by finding the status for each index by
- // using the caller to internal index mapping and looking up the status
- // using the internal index obtained.
- for (size_t i = 0; i < m_callerIndexToInternalIndex->size(); ++i) {
- int internalIndex = m_callerIndexToInternalIndex->operator[](i);
- result[i] = PermissionStatus::createAndListen(m_resolver->executionContext(), statusPtr->operator[](internalIndex), m_internalPermissions->operator[](internalIndex));
- }
- m_resolver->resolve(result);
+ Vector<PermissionStatus*> status;
+ status.reserveCapacity(statusPtr->size());
+ for (size_t i = 0; i < statusPtr->size(); ++i)
+ status.append(PermissionStatus::createAndListen(m_resolver->executionContext(), (*statusPtr)[i], (*m_permissionTypes)[i]));
+
+ m_resolver->resolve(status);
}
void PermissionsCallback::onError()
« no previous file with comments | « third_party/WebKit/Source/modules/permissions/PermissionsCallback.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698