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

Side by Side Diff: third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp

Issue 1411843008: Make blink platform time consistent with the timer virtual time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CachingCorrectnessTest Created 5 years, 1 month 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "CanvasAsyncBlobCreator.h" 6 #include "CanvasAsyncBlobCreator.h"
7 7
8 #include "core/fileapi/File.h" 8 #include "core/fileapi/File.h"
9 #include "platform/Task.h" 9 #include "platform/Task.h"
10 #include "platform/ThreadSafeFunctional.h" 10 #include "platform/ThreadSafeFunctional.h"
11 #include "platform/graphics/ImageBuffer.h" 11 #include "platform/graphics/ImageBuffer.h"
12 #include "platform/image-encoders/skia/PNGImageEncoder.h" 12 #include "platform/image-encoders/skia/PNGImageEncoder.h"
13 #include "public/platform/Platform.h" 13 #include "public/platform/Platform.h"
14 #include "public/platform/WebScheduler.h" 14 #include "public/platform/WebScheduler.h"
15 #include "public/platform/WebTaskRunner.h" 15 #include "public/platform/WebTaskRunner.h"
16 #include "public/platform/WebThread.h" 16 #include "public/platform/WebThread.h"
17 #include "public/platform/WebTraceLocation.h" 17 #include "public/platform/WebTraceLocation.h"
18 #include "wtf/Functional.h" 18 #include "wtf/Functional.h"
19 19
20 namespace blink { 20 namespace blink {
21 21
22 namespace { 22 namespace {
23 23
24 const double SlackBeforeDeadline = 0.001; // a small slack period between deadli ne and current time for safety 24 const double SlackBeforeDeadline = 0.001; // a small slack period between deadli ne and current time for safety
25 const int NumChannelsPng = 4; 25 const int NumChannelsPng = 4;
26 26
27 bool isDeadlineNearOrPassed(double deadlineSeconds) 27 bool isDeadlineNearOrPassed(double deadlineSeconds)
28 { 28 {
29 return (deadlineSeconds - SlackBeforeDeadline - Platform::current()->monoton icallyIncreasingTime() <= 0); 29 return (deadlineSeconds - SlackBeforeDeadline - Platform::current()->monoton icallyIncreasingTimeSeconds() <= 0);
30 } 30 }
31 31
32 } // anonymous namespace 32 } // anonymous namespace
33 33
34 PassRefPtr<CanvasAsyncBlobCreator> CanvasAsyncBlobCreator::create(PassRefPtr<DOM Uint8ClampedArray> unpremultipliedRGBAImageData, const String& mimeType, const I ntSize& size, FileCallback* callback) 34 PassRefPtr<CanvasAsyncBlobCreator> CanvasAsyncBlobCreator::create(PassRefPtr<DOM Uint8ClampedArray> unpremultipliedRGBAImageData, const String& mimeType, const I ntSize& size, FileCallback* callback)
35 { 35 {
36 return adoptRef(new CanvasAsyncBlobCreator(unpremultipliedRGBAImageData, mim eType, size, callback)); 36 return adoptRef(new CanvasAsyncBlobCreator(unpremultipliedRGBAImageData, mim eType, size, callback));
37 } 37 }
38 38
39 CanvasAsyncBlobCreator::CanvasAsyncBlobCreator(PassRefPtr<DOMUint8ClampedArray> data, const String& mimeType, const IntSize& size, FileCallback* callback) 39 CanvasAsyncBlobCreator::CanvasAsyncBlobCreator(PassRefPtr<DOMUint8ClampedArray> data, const String& mimeType, const IntSize& size, FileCallback* callback)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 WebThread* CanvasAsyncBlobCreator::getToBlobThreadInstance() 126 WebThread* CanvasAsyncBlobCreator::getToBlobThreadInstance()
127 { 127 {
128 DEFINE_STATIC_LOCAL(OwnPtr<WebThread>, s_toBlobThread, ()); 128 DEFINE_STATIC_LOCAL(OwnPtr<WebThread>, s_toBlobThread, ());
129 if (!s_toBlobThread) { 129 if (!s_toBlobThread) {
130 s_toBlobThread = adoptPtr(Platform::current()->createThread("Async toBlo b")); 130 s_toBlobThread = adoptPtr(Platform::current()->createThread("Async toBlo b"));
131 } 131 }
132 return s_toBlobThread.get(); 132 return s_toBlobThread.get();
133 } 133 }
134 134
135 } // namespace blink 135 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp ('k') | third_party/WebKit/Source/platform/heap/HeapPage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698