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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp

Issue 2890023003: [IndexedDB] Adding async tracing for renderer calls. (Closed)
Patch Set: test fix Created 3 years, 7 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 DCHECK(context->IsDocument() || context->IsWorkerGlobalScope()); 58 DCHECK(context->IsDocument() || context->IsWorkerGlobalScope());
59 if (context->IsDocument()) { 59 if (context->IsDocument()) {
60 Document* document = ToDocument(context); 60 Document* document = ToDocument(context);
61 return document->GetFrame() && document->GetPage(); 61 return document->GetFrame() && document->GetPage();
62 } 62 }
63 return true; 63 return true;
64 } 64 }
65 65
66 IDBRequest* IDBFactory::getDatabaseNames(ScriptState* script_state, 66 IDBRequest* IDBFactory::getDatabaseNames(ScriptState* script_state,
67 ExceptionState& exception_state) { 67 ExceptionState& exception_state) {
68 IDB_TRACE("IDBFactory::getDatabaseNames"); 68 IDB_TRACE("IDBFactory::getDatabaseNamesCall");
69 IDBRequest::AsyncTraceState metrics("IDBFactory::getDatabaseNames", this);
69 if (!IsContextValid(ExecutionContext::From(script_state))) 70 if (!IsContextValid(ExecutionContext::From(script_state)))
70 return nullptr; 71 return nullptr;
71 if (!ExecutionContext::From(script_state) 72 if (!ExecutionContext::From(script_state)
72 ->GetSecurityOrigin() 73 ->GetSecurityOrigin()
73 ->CanAccessDatabase()) { 74 ->CanAccessDatabase()) {
74 exception_state.ThrowSecurityError( 75 exception_state.ThrowSecurityError(
75 "access to the Indexed Database API is denied in this context."); 76 "access to the Indexed Database API is denied in this context.");
76 return nullptr; 77 return nullptr;
77 } 78 }
78 79
79 IDBRequest* request = 80 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::CreateNull(),
80 IDBRequest::Create(script_state, IDBAny::CreateNull(), nullptr); 81 nullptr, std::move(metrics));
81 82
82 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) 83 if (!IndexedDBClient::From(ExecutionContext::From(script_state))
83 ->AllowIndexedDB(ExecutionContext::From(script_state), 84 ->AllowIndexedDB(ExecutionContext::From(script_state),
84 "Database Listing")) { 85 "Database Listing")) {
85 request->EnqueueResponse( 86 request->EnqueueResponse(
86 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); 87 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage));
87 return request; 88 return request;
88 } 89 }
89 90
90 Platform::Current()->IdbFactory()->GetDatabaseNames( 91 Platform::Current()->IdbFactory()->GetDatabaseNames(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 if (!second->IsValid()) { 224 if (!second->IsValid()) {
224 exception_state.ThrowDOMException(kDataError, 225 exception_state.ThrowDOMException(kDataError,
225 IDBDatabase::kNotValidKeyErrorMessage); 226 IDBDatabase::kNotValidKeyErrorMessage);
226 return 0; 227 return 0;
227 } 228 }
228 229
229 return static_cast<short>(first->Compare(second)); 230 return static_cast<short>(first->Compare(second));
230 } 231 }
231 232
232 } // namespace blink 233 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698