| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * |
| 3 * Copyright 2015, Google Inc. |
| 4 * All rights reserved. |
| 3 * | 5 * |
| 4 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
| 6 * met: | 8 * met: |
| 7 * | 9 * |
| 8 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 12 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer | 13 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 14 * in the documentation and/or other materials provided with the |
| 13 * distribution. | 15 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its | 16 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from | 17 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. | 18 * this software without specific prior written permission. |
| 17 * | 19 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 * |
| 29 */ | 32 */ |
| 30 | 33 |
| 31 #include "core/page/PagePopupSupplement.h" | 34 #ifndef GRPC_INTERNAL_CORE_CHANNEL_CLIENT_MICROCHANNEL_H |
| 35 #define GRPC_INTERNAL_CORE_CHANNEL_CLIENT_MICROCHANNEL_H |
| 32 | 36 |
| 33 #include "core/page/PagePopupController.h" | 37 #include "src/core/channel/channel_stack.h" |
| 38 #include "src/core/client_config/resolver.h" |
| 34 | 39 |
| 35 namespace blink { | 40 #define GRPC_MICROCHANNEL_SUBCHANNEL_ARG "grpc.microchannel_subchannel_key" |
| 36 | 41 |
| 37 PagePopupSupplement::PagePopupSupplement(PagePopup& popup, PagePopupClient* popu
pClient) | 42 /* A client microchannel (aka uchannel) is a channel wrapping a subchannel, for |
| 38 : m_controller(PagePopupController::create(popup, popupClient)) | 43 * the purposes of lightweight RPC communications from within the core.*/ |
| 39 { | |
| 40 ASSERT(popupClient); | |
| 41 } | |
| 42 | 44 |
| 43 const char* PagePopupSupplement::supplementName() | 45 extern const grpc_channel_filter grpc_client_uchannel_filter; |
| 44 { | |
| 45 return "PagePopupSupplement"; | |
| 46 } | |
| 47 | 46 |
| 48 PagePopupController* PagePopupSupplement::pagePopupController(LocalFrame& frame) | 47 grpc_connectivity_state grpc_client_uchannel_check_connectivity_state( |
| 49 { | 48 grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, int try_to_connect); |
| 50 PagePopupSupplement* supplement = static_cast<PagePopupSupplement*>(from(&fr
ame, supplementName())); | |
| 51 ASSERT(supplement); | |
| 52 return supplement->m_controller.get(); | |
| 53 } | |
| 54 | 49 |
| 55 void PagePopupSupplement::install(LocalFrame& frame, PagePopup& popup, PagePopup
Client* popupClient) | 50 void grpc_client_uchannel_watch_connectivity_state( |
| 56 { | 51 grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_pollset *pollset, |
| 57 ASSERT(popupClient); | 52 grpc_connectivity_state *state, grpc_closure *on_complete); |
| 58 provideTo(frame, supplementName(), new PagePopupSupplement(popup, popupClien
t)); | |
| 59 } | |
| 60 | 53 |
| 61 void PagePopupSupplement::uninstall(LocalFrame& frame) | 54 grpc_channel *grpc_client_uchannel_create(grpc_subchannel *subchannel, |
| 62 { | 55 grpc_channel_args *args); |
| 63 pagePopupController(frame)->clearPagePopupClient(); | |
| 64 frame.removeSupplement(supplementName()); | |
| 65 } | |
| 66 | 56 |
| 67 DEFINE_TRACE(PagePopupSupplement) | 57 void grpc_client_uchannel_set_connected_subchannel( |
| 68 { | 58 grpc_channel *uchannel, grpc_connected_subchannel *connected_subchannel); |
| 69 visitor->trace(m_controller); | |
| 70 Supplement<LocalFrame>::trace(visitor); | |
| 71 } | |
| 72 | 59 |
| 73 } // namespace blink | 60 #endif /* GRPC_INTERNAL_CORE_CHANNEL_CLIENT_MICROCHANNEL_H */ |
| OLD | NEW |