Index: third_party/grpc/test/core/profiling/timers_test.c |
diff --git a/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h b/third_party/grpc/test/core/profiling/timers_test.c |
similarity index 55% |
copy from third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h |
copy to third_party/grpc/test/core/profiling/timers_test.c |
index 14300b33e0576462d2062bf8edd4264becbb68fd..7070fe465f17253729bde3cf3c7f599cf5cc6ae3 100644 |
--- a/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h |
+++ b/third_party/grpc/test/core/profiling/timers_test.c |
@@ -1,5 +1,7 @@ |
/* |
- * Copyright (C) 2011 Google Inc. All rights reserved. |
+ * |
+ * Copyright 2015, Google Inc. |
+ * All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are |
@@ -26,42 +28,56 @@ |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ * |
*/ |
-#ifndef StorageQuotaCallbacksImpl_h |
-#define StorageQuotaCallbacksImpl_h |
- |
-#include "bindings/core/v8/ScriptPromiseResolver.h" |
-#include "modules/ModulesExport.h" |
-#include "platform/StorageQuotaCallbacks.h" |
-#include "wtf/OwnPtr.h" |
-#include "wtf/PassRefPtr.h" |
-#include "wtf/RefPtr.h" |
+#include "src/core/profiling/timers.h" |
+#include <stdlib.h> |
+#include "test/core/util/test_config.h" |
-namespace blink { |
- |
-class MODULES_EXPORT StorageQuotaCallbacksImpl final : public StorageQuotaCallbacks { |
- WTF_MAKE_NONCOPYABLE(StorageQuotaCallbacksImpl); |
-public: |
- static StorageQuotaCallbacksImpl* create(ScriptPromiseResolver* resolver) |
- { |
- return new StorageQuotaCallbacksImpl(resolver); |
+void test_log_events(size_t num_seqs) { |
+ size_t start = 0; |
+ size_t *state; |
+ state = calloc(num_seqs, sizeof(state[0])); |
+ while (start < num_seqs) { |
+ size_t i; |
+ size_t row; |
+ if (state[start] == 3) { /* Already done with this posn */ |
+ start++; |
+ continue; |
} |
- ~StorageQuotaCallbacksImpl() override; |
- |
- void didQueryStorageUsageAndQuota(unsigned long long usageInBytes, unsigned long long quotaInBytes) override; |
- void didGrantStorageQuota(unsigned long long usageInBytes, unsigned long long grantedQuotaInBytes) override; |
- void didFail(WebStorageQuotaError) override; |
- |
- DECLARE_VIRTUAL_TRACE(); |
- |
-private: |
- explicit StorageQuotaCallbacksImpl(ScriptPromiseResolver*); |
- |
- Member<ScriptPromiseResolver> m_resolver; |
-}; |
- |
-} // namespace blink |
+ row = (size_t)rand() % 10; /* how many in a row */ |
+ for (i = start; (i < start + row) && (i < num_seqs); i++) { |
+ size_t j; |
+ size_t advance = 1 + (size_t)rand() % 3; /* how many to advance by */ |
+ for (j = 0; j < advance; j++) { |
+ switch (state[i]) { |
+ case 0: |
+ GPR_TIMER_MARK(STATE_0, i); |
+ state[i]++; |
+ break; |
+ case 1: |
+ GPR_TIMER_MARK(STATE_1, i); |
+ state[i]++; |
+ break; |
+ case 2: |
+ GPR_TIMER_MARK(STATE_2, i); |
+ state[i]++; |
+ break; |
+ case 3: |
+ break; |
+ } |
+ } |
+ } |
+ } |
+ free(state); |
+} |
-#endif // StorageQuotaCallbacksImpl_h |
+int main(int argc, char **argv) { |
+ grpc_test_init(argc, argv); |
+ gpr_timers_global_init(); |
+ test_log_events(1000000); |
+ gpr_timers_global_destroy(); |
+ return 0; |
+} |