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

Unified Diff: third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.h

Issue 1743623002: [Experimental Framework] Make the OriginTrialContext a member of ExecutionContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nullptr crash, test that an error message was set Created 4 years, 10 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
Index: third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.h
diff --git a/third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.h b/third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.h
new file mode 100644
index 0000000000000000000000000000000000000000..9375bbce6f3cb0552177d3a69e4946f033471b78
--- /dev/null
+++ b/third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.h
@@ -0,0 +1,40 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DocumentOriginTrialContext_h
+#define DocumentOriginTrialContext_h
+
+#include "core/CoreExport.h"
+#include "core/dom/DOMException.h"
jbroman 2016/02/29 20:41:53 unused header?
iclelland 2016/03/01 21:51:41 Yes. Removed.
+#include "core/dom/Document.h"
+#include "core/origin_trials/OriginTrialContext.h"
+#include "wtf/Vector.h"
jbroman 2016/02/29 20:41:53 I think you only need wtf/Forward.h. Not a big dea
iclelland 2016/03/01 21:51:41 Done.
+#include "wtf/text/WTFString.h"
+#include <utility>
+
+namespace blink {
+
+class WebApiKeyValidator;
+
+// DocumentOriginTrialContext is a specialization of OriginTrialContext for
+// the Document execution context. It enables and disables feature trials based
+// on the tokens found in <meta> tags in the document header.
+class CORE_EXPORT DocumentOriginTrialContext : public OriginTrialContext {
+public:
+ explicit DocumentOriginTrialContext(Document*);
+ ~DocumentOriginTrialContext() override = default;
+
+ ExecutionContext* executionContext() override { return m_parent.get(); }
+
+protected:
+ friend class DocumentOriginTrialContextTest;
+ Vector<String> getTokens() override;
+
+private:
+ RefPtrWillBePersistent<Document> m_parent;
jbroman 2016/02/29 20:41:53 Can this object ever need to extend the lifetime o
sof 2016/02/29 21:26:23 This'll create a Document leak - the owned object
iclelland 2016/03/01 21:51:41 Oilpan complains "Raw pointer field 'm_parent' to
+};
+
+} // namespace blink
+
+#endif // DocumentOriginTrialContext_h

Powered by Google App Engine
This is Rietveld 408576698