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

Unified Diff: third_party/grpc/src/core/iomgr/exec_ctx.c

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « third_party/grpc/src/core/iomgr/exec_ctx.h ('k') | third_party/grpc/src/core/iomgr/executor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/grpc/src/core/iomgr/exec_ctx.c
diff --git a/third_party/WebKit/Source/platform/audio/AudioDSPKernel.h b/third_party/grpc/src/core/iomgr/exec_ctx.c
similarity index 51%
copy from third_party/WebKit/Source/platform/audio/AudioDSPKernel.h
copy to third_party/grpc/src/core/iomgr/exec_ctx.c
index 49466571abfd897cb5814994ba1d487d85268b7f..1fd79f6ebaccdb5a2703cb9fdce7b990150a2cbe 100644
--- a/third_party/WebKit/Source/platform/audio/AudioDSPKernel.h
+++ b/third_party/grpc/src/core/iomgr/exec_ctx.c
@@ -1,5 +1,7 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Copyright 2015-2016, 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,55 +28,49 @@
* 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 AudioDSPKernel_h
-#define AudioDSPKernel_h
-
-#include "platform/audio/AudioDSPKernelProcessor.h"
-#include "wtf/Allocator.h"
+#include "src/core/iomgr/exec_ctx.h"
-namespace blink {
+#include <grpc/support/log.h>
-// AudioDSPKernel does the processing for one channel of an AudioDSPKernelProcessor.
-
-class PLATFORM_EXPORT AudioDSPKernel {
- USING_FAST_MALLOC(AudioDSPKernel);
-public:
- AudioDSPKernel(AudioDSPKernelProcessor* kernelProcessor)
- : m_kernelProcessor(kernelProcessor)
- , m_sampleRate(kernelProcessor->sampleRate())
- {
- }
+#include "src/core/profiling/timers.h"
- AudioDSPKernel(float sampleRate)
- : m_kernelProcessor(nullptr)
- , m_sampleRate(sampleRate)
- {
+bool grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) {
+ bool did_something = 0;
+ GPR_TIMER_BEGIN("grpc_exec_ctx_flush", 0);
+ while (!grpc_closure_list_empty(exec_ctx->closure_list)) {
+ grpc_closure *c = exec_ctx->closure_list.head;
+ exec_ctx->closure_list.head = exec_ctx->closure_list.tail = NULL;
+ while (c != NULL) {
+ bool success = (bool)(c->final_data & 1);
+ grpc_closure *next = (grpc_closure *)(c->final_data & ~(uintptr_t)1);
+ did_something = true;
+ GPR_TIMER_BEGIN("grpc_exec_ctx_flush.cb", 0);
+ c->cb(exec_ctx, c->cb_arg, success);
+ GPR_TIMER_END("grpc_exec_ctx_flush.cb", 0);
+ c = next;
}
+ }
+ GPR_TIMER_END("grpc_exec_ctx_flush", 0);
+ return did_something;
+}
- virtual ~AudioDSPKernel();
-
- // Subclasses must override process() to do the processing and reset() to reset DSP state.
- virtual void process(const float* source, float* destination, size_t framesToProcess) = 0;
- virtual void reset() = 0;
-
- float sampleRate() const { return m_sampleRate; }
- double nyquist() const { return 0.5 * sampleRate(); }
-
- AudioDSPKernelProcessor* processor() { return m_kernelProcessor; }
- const AudioDSPKernelProcessor* processor() const { return m_kernelProcessor; }
-
- virtual double tailTime() const = 0;
- virtual double latencyTime() const = 0;
-
-protected:
- // This raw pointer is safe because the AudioDSPKernelProcessor object is
- // guaranteed to be kept alive while the AudioDSPKernel object is alive.
- AudioDSPKernelProcessor* m_kernelProcessor;
- float m_sampleRate;
-};
+void grpc_exec_ctx_finish(grpc_exec_ctx *exec_ctx) {
+ grpc_exec_ctx_flush(exec_ctx);
+}
-} // namespace blink
+void grpc_exec_ctx_enqueue(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
+ bool success,
+ grpc_workqueue *offload_target_or_null) {
+ GPR_ASSERT(offload_target_or_null == NULL);
+ grpc_closure_list_add(&exec_ctx->closure_list, closure, success);
+}
-#endif // AudioDSPKernel_h
+void grpc_exec_ctx_enqueue_list(grpc_exec_ctx *exec_ctx,
+ grpc_closure_list *list,
+ grpc_workqueue *offload_target_or_null) {
+ GPR_ASSERT(offload_target_or_null == NULL);
+ grpc_closure_list_move(list, &exec_ctx->closure_list);
+}
« no previous file with comments | « third_party/grpc/src/core/iomgr/exec_ctx.h ('k') | third_party/grpc/src/core/iomgr/executor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698