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

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

Issue 2680363003: Deprecate FileReaderSync in service workers. (Closed)
Patch Set: rebase Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/Deprecation.cpp » ('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) 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"
39 #include "platform/Histogram.h" 40 #include "platform/Histogram.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 namespace { 44 namespace {
44 // These values are written to logs. New enum values can be added, but existing 45 // These values are written to logs. New enum values can be added, but existing
45 // enums must never be renumbered or deleted and reused. 46 // enums must never be renumbered or deleted and reused.
46 enum class WorkerType { 47 enum class WorkerType {
47 OTHER = 0, 48 OTHER = 0,
48 DEDICATED_WORKER = 1, 49 DEDICATED_WORKER = 1,
49 SHARED_WORKER = 2, 50 SHARED_WORKER = 2,
50 SERVICE_WORKER = 3, 51 SERVICE_WORKER = 3,
51 MAX 52 MAX
52 }; 53 };
53 } // namespace 54 } // namespace
54 55
55 FileReaderSync::FileReaderSync(ExecutionContext* context) { 56 FileReaderSync::FileReaderSync(ExecutionContext* context) {
57 if (context->isServiceWorkerGlobalScope()) {
58 Deprecation::countDeprecation(context,
59 UseCounter::FileReaderSyncInServiceWorker);
60 }
61
56 WorkerType type = WorkerType::OTHER; 62 WorkerType type = WorkerType::OTHER;
57 if (context->isDedicatedWorkerGlobalScope()) 63 if (context->isDedicatedWorkerGlobalScope())
58 type = WorkerType::DEDICATED_WORKER; 64 type = WorkerType::DEDICATED_WORKER;
59 else if (context->isSharedWorkerGlobalScope()) 65 else if (context->isSharedWorkerGlobalScope())
60 type = WorkerType::SHARED_WORKER; 66 type = WorkerType::SHARED_WORKER;
61 else if (context->isServiceWorkerGlobalScope()) 67 else if (context->isServiceWorkerGlobalScope())
62 type = WorkerType::SERVICE_WORKER; 68 type = WorkerType::SERVICE_WORKER;
63 DEFINE_THREAD_SAFE_STATIC_LOCAL( 69 DEFINE_THREAD_SAFE_STATIC_LOCAL(
64 EnumerationHistogram, workerTypeHistogram, 70 EnumerationHistogram, workerTypeHistogram,
65 new EnumerationHistogram("FileReaderSync.WorkerType", 71 new EnumerationHistogram("FileReaderSync.WorkerType",
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void FileReaderSync::startLoading(ExecutionContext* executionContext, 129 void FileReaderSync::startLoading(ExecutionContext* executionContext,
124 FileReaderLoader& loader, 130 FileReaderLoader& loader,
125 const Blob& blob, 131 const Blob& blob,
126 ExceptionState& exceptionState) { 132 ExceptionState& exceptionState) {
127 loader.start(executionContext, blob.blobDataHandle()); 133 loader.start(executionContext, blob.blobDataHandle());
128 if (loader.errorCode()) 134 if (loader.errorCode())
129 FileError::throwDOMException(exceptionState, loader.errorCode()); 135 FileError::throwDOMException(exceptionState, loader.errorCode());
130 } 136 }
131 137
132 } // namespace blink 138 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/Deprecation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698