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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp

Issue 2053943002: [DurableStorage] Enable origin trial on workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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/WorkerNavigatorStorageQuota.idl » ('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 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 29 matching lines...) Expand all
40 #include "bindings/modules/v8/V8IDBCursor.h" 40 #include "bindings/modules/v8/V8IDBCursor.h"
41 #include "bindings/modules/v8/V8IDBCursorWithValue.h" 41 #include "bindings/modules/v8/V8IDBCursorWithValue.h"
42 #include "bindings/modules/v8/V8IDBDatabase.h" 42 #include "bindings/modules/v8/V8IDBDatabase.h"
43 #include "bindings/modules/v8/V8IDBIndex.h" 43 #include "bindings/modules/v8/V8IDBIndex.h"
44 #include "bindings/modules/v8/V8IDBKeyRange.h" 44 #include "bindings/modules/v8/V8IDBKeyRange.h"
45 #include "bindings/modules/v8/V8IDBObjectStore.h" 45 #include "bindings/modules/v8/V8IDBObjectStore.h"
46 #include "bindings/modules/v8/V8NavigatorPartial.h" 46 #include "bindings/modules/v8/V8NavigatorPartial.h"
47 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" 47 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h"
48 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" 48 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h"
49 #include "bindings/modules/v8/V8WindowPartial.h" 49 #include "bindings/modules/v8/V8WindowPartial.h"
50 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h"
50 #include "bindings/modules/v8/V8WorkletGlobalScope.h" 51 #include "bindings/modules/v8/V8WorkletGlobalScope.h"
51 #include "core/dom/DOMArrayBuffer.h" 52 #include "core/dom/DOMArrayBuffer.h"
52 #include "core/dom/DOMArrayBufferView.h" 53 #include "core/dom/DOMArrayBufferView.h"
53 #include "core/dom/ExecutionContext.h" 54 #include "core/dom/ExecutionContext.h"
54 #include "core/origin_trials/OriginTrialContext.h" 55 #include "core/origin_trials/OriginTrialContext.h"
55 #include "modules/indexeddb/IDBKey.h" 56 #include "modules/indexeddb/IDBKey.h"
56 #include "modules/indexeddb/IDBKeyPath.h" 57 #include "modules/indexeddb/IDBKeyPath.h"
57 #include "modules/indexeddb/IDBKeyRange.h" 58 #include "modules/indexeddb/IDBKeyRange.h"
58 #include "modules/indexeddb/IDBTracing.h" 59 #include "modules/indexeddb/IDBTracing.h"
59 #include "modules/indexeddb/IDBValue.h" 60 #include "modules/indexeddb/IDBValue.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 ExecutionContext* executionContext = toExecutionContext(context); 554 ExecutionContext* executionContext = toExecutionContext(context);
554 OriginTrialContext* originTrialContext = OriginTrialContext::from(executionC ontext, OriginTrialContext::DontCreateIfNotExists); 555 OriginTrialContext* originTrialContext = OriginTrialContext::from(executionC ontext, OriginTrialContext::DontCreateIfNotExists);
555 if (!originTrialContext) 556 if (!originTrialContext)
556 return; 557 return;
557 558
558 ScriptState::Scope scope(scriptState); 559 ScriptState::Scope scope(scriptState);
559 v8::Local<v8::Object> global = context->Global(); 560 v8::Local<v8::Object> global = context->Global();
560 v8::Isolate* isolate = scriptState->isolate(); 561 v8::Isolate* isolate = scriptState->isolate();
561 562
562 if (!originTrialContext->featureBindingsInstalled("DurableStorage") && (Runt imeEnabledFeatures::durableStorageEnabled() || originTrialContext->isFeatureEnab led("DurableStorage", nullptr))) { 563 if (!originTrialContext->featureBindingsInstalled("DurableStorage") && (Runt imeEnabledFeatures::durableStorageEnabled() || originTrialContext->isFeatureEnab led("DurableStorage", nullptr))) {
564 v8::Local<v8::String> navigatorName = v8::String::NewFromOneByte(isolate , reinterpret_cast<const uint8_t*>("navigator"), v8::NewStringType::kNormal).ToL ocalChecked();
563 if (executionContext->isDocument()) { 565 if (executionContext->isDocument()) {
564 v8::Local<v8::String> navigatorName = v8::String::NewFromOneByte(iso late, reinterpret_cast<const uint8_t*>("navigator"), v8::NewStringType::kNormal) .ToLocalChecked();
565 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject(); 566 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject();
566 V8WindowPartial::installDurableStorage(scriptState, global); 567 V8WindowPartial::installDurableStorage(scriptState, global);
567 V8NavigatorPartial::installDurableStorage(scriptState, navigator); 568 V8NavigatorPartial::installDurableStorage(scriptState, navigator);
568 } else if (executionContext->isSharedWorkerGlobalScope()) { 569 } else if (executionContext->isSharedWorkerGlobalScope()) {
570 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject();
569 V8SharedWorkerGlobalScopePartial::installDurableStorage(scriptState, global); 571 V8SharedWorkerGlobalScopePartial::installDurableStorage(scriptState, global);
572 V8WorkerNavigatorPartial::installDurableStorage(scriptState, navigat or);
570 } else if (executionContext->isDedicatedWorkerGlobalScope()) { 573 } else if (executionContext->isDedicatedWorkerGlobalScope()) {
574 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject();
571 V8DedicatedWorkerGlobalScopePartial::installDurableStorage(scriptSta te, global); 575 V8DedicatedWorkerGlobalScopePartial::installDurableStorage(scriptSta te, global);
576 V8WorkerNavigatorPartial::installDurableStorage(scriptState, navigat or);
572 } else if (executionContext->isServiceWorkerGlobalScope()) { 577 } else if (executionContext->isServiceWorkerGlobalScope()) {
578 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject();
573 V8ServiceWorkerGlobalScope::installDurableStorage(scriptState, globa l); 579 V8ServiceWorkerGlobalScope::installDurableStorage(scriptState, globa l);
580 V8WorkerNavigatorPartial::installDurableStorage(scriptState, navigat or);
574 } 581 }
575 originTrialContext->setFeatureBindingsInstalled("DurableStorage"); 582 originTrialContext->setFeatureBindingsInstalled("DurableStorage");
576 } 583 }
577 } 584 }
578 585
579 void registerInstallOriginTrialsForModules() 586 void registerInstallOriginTrialsForModules()
580 { 587 {
581 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst allOriginTrialsForModules); 588 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst allOriginTrialsForModules);
582 } 589 }
583 } // namespace blink 590 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/quota/WorkerNavigatorStorageQuota.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698