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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp

Issue 2753943002: Disable FileReaderSync in service workers. (Closed)
Patch Set: rebase Created 3 years, 9 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 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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "core/fileapi/FileReaderSync.h" 31 #include "core/fileapi/FileReaderSync.h"
32 32
33 #include "bindings/core/v8/ExceptionState.h" 33 #include "bindings/core/v8/ExceptionState.h"
34 #include "bindings/core/v8/ScriptState.h" 34 #include "bindings/core/v8/ScriptState.h"
35 #include "core/dom/DOMArrayBuffer.h" 35 #include "core/dom/DOMArrayBuffer.h"
36 #include "core/fileapi/Blob.h" 36 #include "core/fileapi/Blob.h"
37 #include "core/fileapi/FileError.h" 37 #include "core/fileapi/FileError.h"
38 #include "core/fileapi/FileReaderLoader.h" 38 #include "core/fileapi/FileReaderLoader.h"
39 #include "core/frame/Deprecation.h"
40 #include "platform/Histogram.h" 39 #include "platform/Histogram.h"
41 40
42 namespace blink { 41 namespace blink {
43 42
44 namespace { 43 namespace {
45 // These values are written to logs. New enum values can be added, but existing 44 // These values are written to logs. New enum values can be added, but existing
46 // enums must never be renumbered or deleted and reused. 45 // enums must never be renumbered or deleted and reused.
47 enum class WorkerType { 46 enum class WorkerType {
48 OTHER = 0, 47 OTHER = 0,
49 DEDICATED_WORKER = 1, 48 DEDICATED_WORKER = 1,
50 SHARED_WORKER = 2, 49 SHARED_WORKER = 2,
51 SERVICE_WORKER = 3, 50 SERVICE_WORKER = 3,
52 MAX 51 MAX
53 }; 52 };
54 } // namespace 53 } // namespace
55 54
56 FileReaderSync::FileReaderSync(ExecutionContext* context) { 55 FileReaderSync::FileReaderSync(ExecutionContext* context) {
57 if (context->isServiceWorkerGlobalScope()) {
58 Deprecation::countDeprecation(context,
59 UseCounter::FileReaderSyncInServiceWorker);
foolip 2017/03/21 09:00:02 Can you remove the entry from UseCounter.h as well
Marijn Kruisselbrink 2017/03/21 17:04:17 Done
60 }
61
62 WorkerType type = WorkerType::OTHER; 56 WorkerType type = WorkerType::OTHER;
63 if (context->isDedicatedWorkerGlobalScope()) 57 if (context->isDedicatedWorkerGlobalScope())
64 type = WorkerType::DEDICATED_WORKER; 58 type = WorkerType::DEDICATED_WORKER;
65 else if (context->isSharedWorkerGlobalScope()) 59 else if (context->isSharedWorkerGlobalScope())
66 type = WorkerType::SHARED_WORKER; 60 type = WorkerType::SHARED_WORKER;
67 else if (context->isServiceWorkerGlobalScope()) 61 else if (context->isServiceWorkerGlobalScope())
68 type = WorkerType::SERVICE_WORKER; 62 type = WorkerType::SERVICE_WORKER;
69 DEFINE_THREAD_SAFE_STATIC_LOCAL( 63 DEFINE_THREAD_SAFE_STATIC_LOCAL(
70 EnumerationHistogram, workerTypeHistogram, 64 EnumerationHistogram, workerTypeHistogram,
71 new EnumerationHistogram("FileReaderSync.WorkerType", 65 new EnumerationHistogram("FileReaderSync.WorkerType",
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void FileReaderSync::startLoading(ExecutionContext* executionContext, 123 void FileReaderSync::startLoading(ExecutionContext* executionContext,
130 FileReaderLoader& loader, 124 FileReaderLoader& loader,
131 const Blob& blob, 125 const Blob& blob,
132 ExceptionState& exceptionState) { 126 ExceptionState& exceptionState) {
133 loader.start(executionContext, blob.blobDataHandle()); 127 loader.start(executionContext, blob.blobDataHandle());
134 if (loader.errorCode()) 128 if (loader.errorCode())
135 FileError::throwDOMException(exceptionState, loader.errorCode()); 129 FileError::throwDOMException(exceptionState, loader.errorCode());
136 } 130 }
137 131
138 } // namespace blink 132 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698