1 // Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 2 // Google Inc. All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions are 6 // met: 7 // 8 // * Redistributions of source code must retain the above copyright 9 // notice, this list of conditions and the following disclaimer. 10 // * Redistributions in binary form must reproduce the above 11 // copyright notice, this list of conditions and the following disclaimer 12 // in the documentation and/or other materials provided with the 13 // distribution. 14 // * Neither the name of Google Inc. nor the name Chromium Embedded 15 // Framework nor the names of its contributors may be used to endorse 16 // or promote products derived from this software without specific prior 17 // written permission. 18 // 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 31 // A Tuple is a generic templatized container, similar in concept to std::pair. 32 // There are classes Tuple0 to Tuple6, cooresponding to the number of elements 33 // it contains. The convenient MakeTuple() function takes 0 to 6 arguments, 34 // and will construct and return the appropriate Tuple object. The functions 35 // DispatchToMethod and DispatchToFunction take a function pointer or instance 36 // and method pointer, and unpack a tuple into arguments to the call. 37 // 38 // Tuple elements are copied by value, and stored in the tuple. See the unit 39 // tests for more details of how/when the values are copied. 40 // 41 // Example usage: 42 // // These two methods of creating a Tuple are identical. 43 // Tuple2<int, const char*> tuple_a(1, "wee"); 44 // Tuple2<int, const char*> tuple_b = MakeTuple(1, "wee"); 45 // 46 // void SomeFunc(int a, const char* b) { } 47 // DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee") 48 // DispatchToFunction( 49 // &SomeFunc, MakeTuple(10, "foo")); // SomeFunc(10, "foo") 50 // 51 // struct { void SomeMeth(int a, int b, int c) { } } foo; 52 // DispatchToMethod(&foo, &Foo::SomeMeth, MakeTuple(1, 2, 3)); 53 // // foo->SomeMeth(1, 2, 3); 54 55 #ifndef CEF_INCLUDE_BASE_CEF_TUPLE_H_ 56 #define CEF_INCLUDE_BASE_CEF_TUPLE_H_ 57 #pragma once 58 59 #if defined(BASE_TUPLE_H_) 60 // Do nothing if the Chromium header has already been included. 61 // This can happen in cases where Chromium code is used directly by the 62 // client application. When using Chromium code directly always include 63 // the Chromium header first to avoid type conflicts. 64 #elif defined(USING_CHROMIUM_INCLUDES) 65 // When building CEF include the Chromium header directly. 66 #include "base/tuple.h" 67 #else // !USING_CHROMIUM_INCLUDES 68 // The following is substantially similar to the Chromium implementation. 69 // If the Chromium implementation diverges the below implementation should be 70 // updated to match. 71 72 #include "include/base/cef_bind_helpers.h" 73 74 namespace base { 75 76 // Traits ---------------------------------------------------------------------- 77 // 78 // A simple traits class for tuple arguments. 79 // 80 // ValueType: the bare, nonref version of a type (same as the type for nonrefs). 81 // RefType: the ref version of a type (same as the type for refs). 82 // ParamType: what type to pass to functions (refs should not be constified). 83 84 template <class P> 85 struct TupleTraits { 86 typedef P ValueType; 87 typedef P& RefType; 88 typedef const P& ParamType; 89 }; 90 91 template <class P> 92 struct TupleTraits<P&> { 93 typedef P ValueType; 94 typedef P& RefType; 95 typedef P& ParamType; 96 }; 97 98 template <class P> 99 struct TupleTypes {}; 100 101 // Tuple ----------------------------------------------------------------------- 102 // 103 // This set of classes is useful for bundling 0 or more heterogeneous data types 104 // into a single variable. The advantage of this is that it greatly simplifies 105 // function objects that need to take an arbitrary number of parameters; see 106 // RunnableMethod and IPC::MessageWithTuple. 107 // 108 // Tuple0 is supplied to act as a 'void' type. It can be used, for example, 109 // when dispatching to a function that accepts no arguments (see the 110 // Dispatchers below). 111 // Tuple1<A> is rarely useful. One such use is when A is non-const ref that you 112 // want filled by the dispatchee, and the tuple is merely a container for that 113 // output (a "tier"). See MakeRefTuple and its usages. 114 115 struct Tuple0 { 116 typedef Tuple0 ValueTuple; 117 typedef Tuple0 RefTuple; 118 typedef Tuple0 ParamTuple; 119 }; 120 121 template <class A> 122 struct Tuple1 { 123 public: 124 typedef A TypeA; 125 126 Tuple1() {} 127 explicit Tuple1(typename TupleTraits<A>::ParamType a) : a(a) {} 128 129 A a; 130 }; 131 132 template <class A, class B> 133 struct Tuple2 { 134 public: 135 typedef A TypeA; 136 typedef B TypeB; 137 138 Tuple2() {} 139 Tuple2(typename TupleTraits<A>::ParamType a, 140 typename TupleTraits<B>::ParamType b) 141 : a(a), b(b) {} 142 143 A a; 144 B b; 145 }; 146 147 template <class A, class B, class C> 148 struct Tuple3 { 149 public: 150 typedef A TypeA; 151 typedef B TypeB; 152 typedef C TypeC; 153 154 Tuple3() {} 155 Tuple3(typename TupleTraits<A>::ParamType a, 156 typename TupleTraits<B>::ParamType b, 157 typename TupleTraits<C>::ParamType c) 158 : a(a), b(b), c(c) {} 159 160 A a; 161 B b; 162 C c; 163 }; 164 165 template <class A, class B, class C, class D> 166 struct Tuple4 { 167 public: 168 typedef A TypeA; 169 typedef B TypeB; 170 typedef C TypeC; 171 typedef D TypeD; 172 173 Tuple4() {} 174 Tuple4(typename TupleTraits<A>::ParamType a, 175 typename TupleTraits<B>::ParamType b, 176 typename TupleTraits<C>::ParamType c, 177 typename TupleTraits<D>::ParamType d) 178 : a(a), b(b), c(c), d(d) {} 179 180 A a; 181 B b; 182 C c; 183 D d; 184 }; 185 186 template <class A, class B, class C, class D, class E> 187 struct Tuple5 { 188 public: 189 typedef A TypeA; 190 typedef B TypeB; 191 typedef C TypeC; 192 typedef D TypeD; 193 typedef E TypeE; 194 195 Tuple5() {} 196 Tuple5(typename TupleTraits<A>::ParamType a, 197 typename TupleTraits<B>::ParamType b, 198 typename TupleTraits<C>::ParamType c, 199 typename TupleTraits<D>::ParamType d, 200 typename TupleTraits<E>::ParamType e) 201 : a(a), b(b), c(c), d(d), e(e) {} 202 203 A a; 204 B b; 205 C c; 206 D d; 207 E e; 208 }; 209 210 template <class A, class B, class C, class D, class E, class F> 211 struct Tuple6 { 212 public: 213 typedef A TypeA; 214 typedef B TypeB; 215 typedef C TypeC; 216 typedef D TypeD; 217 typedef E TypeE; 218 typedef F TypeF; 219 220 Tuple6() {} 221 Tuple6(typename TupleTraits<A>::ParamType a, 222 typename TupleTraits<B>::ParamType b, 223 typename TupleTraits<C>::ParamType c, 224 typename TupleTraits<D>::ParamType d, 225 typename TupleTraits<E>::ParamType e, 226 typename TupleTraits<F>::ParamType f) 227 : a(a), b(b), c(c), d(d), e(e), f(f) {} 228 229 A a; 230 B b; 231 C c; 232 D d; 233 E e; 234 F f; 235 }; 236 237 template <class A, class B, class C, class D, class E, class F, class G> 238 struct Tuple7 { 239 public: 240 typedef A TypeA; 241 typedef B TypeB; 242 typedef C TypeC; 243 typedef D TypeD; 244 typedef E TypeE; 245 typedef F TypeF; 246 typedef G TypeG; 247 248 Tuple7() {} 249 Tuple7(typename TupleTraits<A>::ParamType a, 250 typename TupleTraits<B>::ParamType b, 251 typename TupleTraits<C>::ParamType c, 252 typename TupleTraits<D>::ParamType d, 253 typename TupleTraits<E>::ParamType e, 254 typename TupleTraits<F>::ParamType f, 255 typename TupleTraits<G>::ParamType g) 256 : a(a), b(b), c(c), d(d), e(e), f(f), g(g) {} 257 258 A a; 259 B b; 260 C c; 261 D d; 262 E e; 263 F f; 264 G g; 265 }; 266 267 template <class A, 268 class B, 269 class C, 270 class D, 271 class E, 272 class F, 273 class G, 274 class H> 275 struct Tuple8 { 276 public: 277 typedef A TypeA; 278 typedef B TypeB; 279 typedef C TypeC; 280 typedef D TypeD; 281 typedef E TypeE; 282 typedef F TypeF; 283 typedef G TypeG; 284 typedef H TypeH; 285 286 Tuple8() {} 287 Tuple8(typename TupleTraits<A>::ParamType a, 288 typename TupleTraits<B>::ParamType b, 289 typename TupleTraits<C>::ParamType c, 290 typename TupleTraits<D>::ParamType d, 291 typename TupleTraits<E>::ParamType e, 292 typename TupleTraits<F>::ParamType f, 293 typename TupleTraits<G>::ParamType g, 294 typename TupleTraits<H>::ParamType h) 295 : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h) {} 296 297 A a; 298 B b; 299 C c; 300 D d; 301 E e; 302 F f; 303 G g; 304 H h; 305 }; 306 307 // Tuple types ---------------------------------------------------------------- 308 // 309 // Allows for selection of ValueTuple/RefTuple/ParamTuple without needing the 310 // definitions of class types the tuple takes as parameters. 311 312 template <> 313 struct TupleTypes<Tuple0> { 314 typedef Tuple0 ValueTuple; 315 typedef Tuple0 RefTuple; 316 typedef Tuple0 ParamTuple; 317 }; 318 319 template <class A> 320 struct TupleTypes<Tuple1<A>> { 321 typedef Tuple1<typename TupleTraits<A>::ValueType> ValueTuple; 322 typedef Tuple1<typename TupleTraits<A>::RefType> RefTuple; 323 typedef Tuple1<typename TupleTraits<A>::ParamType> ParamTuple; 324 }; 325 326 template <class A, class B> 327 struct TupleTypes<Tuple2<A, B>> { 328 typedef Tuple2<typename TupleTraits<A>::ValueType, 329 typename TupleTraits<B>::ValueType> 330 ValueTuple; 331 typedef Tuple2<typename TupleTraits<A>::RefType, 332 typename TupleTraits<B>::RefType> 333 RefTuple; 334 typedef Tuple2<typename TupleTraits<A>::ParamType, 335 typename TupleTraits<B>::ParamType> 336 ParamTuple; 337 }; 338 339 template <class A, class B, class C> 340 struct TupleTypes<Tuple3<A, B, C>> { 341 typedef Tuple3<typename TupleTraits<A>::ValueType, 342 typename TupleTraits<B>::ValueType, 343 typename TupleTraits<C>::ValueType> 344 ValueTuple; 345 typedef Tuple3<typename TupleTraits<A>::RefType, 346 typename TupleTraits<B>::RefType, 347 typename TupleTraits<C>::RefType> 348 RefTuple; 349 typedef Tuple3<typename TupleTraits<A>::ParamType, 350 typename TupleTraits<B>::ParamType, 351 typename TupleTraits<C>::ParamType> 352 ParamTuple; 353 }; 354 355 template <class A, class B, class C, class D> 356 struct TupleTypes<Tuple4<A, B, C, D>> { 357 typedef Tuple4<typename TupleTraits<A>::ValueType, 358 typename TupleTraits<B>::ValueType, 359 typename TupleTraits<C>::ValueType, 360 typename TupleTraits<D>::ValueType> 361 ValueTuple; 362 typedef Tuple4<typename TupleTraits<A>::RefType, 363 typename TupleTraits<B>::RefType, 364 typename TupleTraits<C>::RefType, 365 typename TupleTraits<D>::RefType> 366 RefTuple; 367 typedef Tuple4<typename TupleTraits<A>::ParamType, 368 typename TupleTraits<B>::ParamType, 369 typename TupleTraits<C>::ParamType, 370 typename TupleTraits<D>::ParamType> 371 ParamTuple; 372 }; 373 374 template <class A, class B, class C, class D, class E> 375 struct TupleTypes<Tuple5<A, B, C, D, E>> { 376 typedef Tuple5<typename TupleTraits<A>::ValueType, 377 typename TupleTraits<B>::ValueType, 378 typename TupleTraits<C>::ValueType, 379 typename TupleTraits<D>::ValueType, 380 typename TupleTraits<E>::ValueType> 381 ValueTuple; 382 typedef Tuple5<typename TupleTraits<A>::RefType, 383 typename TupleTraits<B>::RefType, 384 typename TupleTraits<C>::RefType, 385 typename TupleTraits<D>::RefType, 386 typename TupleTraits<E>::RefType> 387 RefTuple; 388 typedef Tuple5<typename TupleTraits<A>::ParamType, 389 typename TupleTraits<B>::ParamType, 390 typename TupleTraits<C>::ParamType, 391 typename TupleTraits<D>::ParamType, 392 typename TupleTraits<E>::ParamType> 393 ParamTuple; 394 }; 395 396 template <class A, class B, class C, class D, class E, class F> 397 struct TupleTypes<Tuple6<A, B, C, D, E, F>> { 398 typedef Tuple6<typename TupleTraits<A>::ValueType, 399 typename TupleTraits<B>::ValueType, 400 typename TupleTraits<C>::ValueType, 401 typename TupleTraits<D>::ValueType, 402 typename TupleTraits<E>::ValueType, 403 typename TupleTraits<F>::ValueType> 404 ValueTuple; 405 typedef Tuple6<typename TupleTraits<A>::RefType, 406 typename TupleTraits<B>::RefType, 407 typename TupleTraits<C>::RefType, 408 typename TupleTraits<D>::RefType, 409 typename TupleTraits<E>::RefType, 410 typename TupleTraits<F>::RefType> 411 RefTuple; 412 typedef Tuple6<typename TupleTraits<A>::ParamType, 413 typename TupleTraits<B>::ParamType, 414 typename TupleTraits<C>::ParamType, 415 typename TupleTraits<D>::ParamType, 416 typename TupleTraits<E>::ParamType, 417 typename TupleTraits<F>::ParamType> 418 ParamTuple; 419 }; 420 421 template <class A, class B, class C, class D, class E, class F, class G> 422 struct TupleTypes<Tuple7<A, B, C, D, E, F, G>> { 423 typedef Tuple7<typename TupleTraits<A>::ValueType, 424 typename TupleTraits<B>::ValueType, 425 typename TupleTraits<C>::ValueType, 426 typename TupleTraits<D>::ValueType, 427 typename TupleTraits<E>::ValueType, 428 typename TupleTraits<F>::ValueType, 429 typename TupleTraits<G>::ValueType> 430 ValueTuple; 431 typedef Tuple7<typename TupleTraits<A>::RefType, 432 typename TupleTraits<B>::RefType, 433 typename TupleTraits<C>::RefType, 434 typename TupleTraits<D>::RefType, 435 typename TupleTraits<E>::RefType, 436 typename TupleTraits<F>::RefType, 437 typename TupleTraits<G>::RefType> 438 RefTuple; 439 typedef Tuple7<typename TupleTraits<A>::ParamType, 440 typename TupleTraits<B>::ParamType, 441 typename TupleTraits<C>::ParamType, 442 typename TupleTraits<D>::ParamType, 443 typename TupleTraits<E>::ParamType, 444 typename TupleTraits<F>::ParamType, 445 typename TupleTraits<G>::ParamType> 446 ParamTuple; 447 }; 448 449 template <class A, 450 class B, 451 class C, 452 class D, 453 class E, 454 class F, 455 class G, 456 class H> 457 struct TupleTypes<Tuple8<A, B, C, D, E, F, G, H>> { 458 typedef Tuple8<typename TupleTraits<A>::ValueType, 459 typename TupleTraits<B>::ValueType, 460 typename TupleTraits<C>::ValueType, 461 typename TupleTraits<D>::ValueType, 462 typename TupleTraits<E>::ValueType, 463 typename TupleTraits<F>::ValueType, 464 typename TupleTraits<G>::ValueType, 465 typename TupleTraits<H>::ValueType> 466 ValueTuple; 467 typedef Tuple8<typename TupleTraits<A>::RefType, 468 typename TupleTraits<B>::RefType, 469 typename TupleTraits<C>::RefType, 470 typename TupleTraits<D>::RefType, 471 typename TupleTraits<E>::RefType, 472 typename TupleTraits<F>::RefType, 473 typename TupleTraits<G>::RefType, 474 typename TupleTraits<H>::RefType> 475 RefTuple; 476 typedef Tuple8<typename TupleTraits<A>::ParamType, 477 typename TupleTraits<B>::ParamType, 478 typename TupleTraits<C>::ParamType, 479 typename TupleTraits<D>::ParamType, 480 typename TupleTraits<E>::ParamType, 481 typename TupleTraits<F>::ParamType, 482 typename TupleTraits<G>::ParamType, 483 typename TupleTraits<H>::ParamType> 484 ParamTuple; 485 }; 486 487 // Tuple creators ------------------------------------------------------------- 488 // 489 // Helper functions for constructing tuples while inferring the template 490 // argument types. 491 492 inline Tuple0 MakeTuple() { 493 return Tuple0(); 494 } 495 496 template <class A> 497 inline Tuple1<A> MakeTuple(const A& a) { 498 return Tuple1<A>(a); 499 } 500 501 template <class A, class B> 502 inline Tuple2<A, B> MakeTuple(const A& a, const B& b) { 503 return Tuple2<A, B>(a, b); 504 } 505 506 template <class A, class B, class C> 507 inline Tuple3<A, B, C> MakeTuple(const A& a, const B& b, const C& c) { 508 return Tuple3<A, B, C>(a, b, c); 509 } 510 511 template <class A, class B, class C, class D> 512 inline Tuple4<A, B, C, D> MakeTuple(const A& a, 513 const B& b, 514 const C& c, 515 const D& d) { 516 return Tuple4<A, B, C, D>(a, b, c, d); 517 } 518 519 template <class A, class B, class C, class D, class E> 520 inline Tuple5<A, B, C, D, E> MakeTuple(const A& a, 521 const B& b, 522 const C& c, 523 const D& d, 524 const E& e) { 525 return Tuple5<A, B, C, D, E>(a, b, c, d, e); 526 } 527 528 template <class A, class B, class C, class D, class E, class F> 529 inline Tuple6<A, B, C, D, E, F> MakeTuple(const A& a, 530 const B& b, 531 const C& c, 532 const D& d, 533 const E& e, 534 const F& f) { 535 return Tuple6<A, B, C, D, E, F>(a, b, c, d, e, f); 536 } 537 538 template <class A, class B, class C, class D, class E, class F, class G> 539 inline Tuple7<A, B, C, D, E, F, G> MakeTuple(const A& a, 540 const B& b, 541 const C& c, 542 const D& d, 543 const E& e, 544 const F& f, 545 const G& g) { 546 return Tuple7<A, B, C, D, E, F, G>(a, b, c, d, e, f, g); 547 } 548 549 template <class A, 550 class B, 551 class C, 552 class D, 553 class E, 554 class F, 555 class G, 556 class H> 557 inline Tuple8<A, B, C, D, E, F, G, H> MakeTuple(const A& a, 558 const B& b, 559 const C& c, 560 const D& d, 561 const E& e, 562 const F& f, 563 const G& g, 564 const H& h) { 565 return Tuple8<A, B, C, D, E, F, G, H>(a, b, c, d, e, f, g, h); 566 } 567 568 // The following set of helpers make what Boost refers to as "Tiers" - a tuple 569 // of references. 570 571 template <class A> 572 inline Tuple1<A&> MakeRefTuple(A& a) { 573 return Tuple1<A&>(a); 574 } 575 576 template <class A, class B> 577 inline Tuple2<A&, B&> MakeRefTuple(A& a, B& b) { 578 return Tuple2<A&, B&>(a, b); 579 } 580 581 template <class A, class B, class C> 582 inline Tuple3<A&, B&, C&> MakeRefTuple(A& a, B& b, C& c) { 583 return Tuple3<A&, B&, C&>(a, b, c); 584 } 585 586 template <class A, class B, class C, class D> 587 inline Tuple4<A&, B&, C&, D&> MakeRefTuple(A& a, B& b, C& c, D& d) { 588 return Tuple4<A&, B&, C&, D&>(a, b, c, d); 589 } 590 591 template <class A, class B, class C, class D, class E> 592 inline Tuple5<A&, B&, C&, D&, E&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e) { 593 return Tuple5<A&, B&, C&, D&, E&>(a, b, c, d, e); 594 } 595 596 template <class A, class B, class C, class D, class E, class F> 597 inline Tuple6<A&, B&, C&, D&, E&, F&> MakeRefTuple(A& a, 598 B& b, 599 C& c, 600 D& d, 601 E& e, 602 F& f) { 603 return Tuple6<A&, B&, C&, D&, E&, F&>(a, b, c, d, e, f); 604 } 605 606 template <class A, class B, class C, class D, class E, class F, class G> 607 inline Tuple7<A&, B&, C&, D&, E&, F&, G&> 608 MakeRefTuple(A& a, B& b, C& c, D& d, E& e, F& f, G& g) { 609 return Tuple7<A&, B&, C&, D&, E&, F&, G&>(a, b, c, d, e, f, g); 610 } 611 612 template <class A, 613 class B, 614 class C, 615 class D, 616 class E, 617 class F, 618 class G, 619 class H> 620 inline Tuple8<A&, B&, C&, D&, E&, F&, G&, H&> 621 MakeRefTuple(A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h) { 622 return Tuple8<A&, B&, C&, D&, E&, F&, G&, H&>(a, b, c, d, e, f, g, h); 623 } 624 625 // Dispatchers ---------------------------------------------------------------- 626 // 627 // Helper functions that call the given method on an object, with the unpacked 628 // tuple arguments. Notice that they all have the same number of arguments, 629 // so you need only write: 630 // DispatchToMethod(object, &Object::method, args); 631 // This is very useful for templated dispatchers, since they don't need to know 632 // what type |args| is. 633 634 // Non-Static Dispatchers with no out params. 635 636 template <class ObjT, class Method> 637 inline void DispatchToMethod(ObjT* obj, Method method, const Tuple0& arg) { 638 (obj->*method)(); 639 } 640 641 template <class ObjT, class Method, class A> 642 inline void DispatchToMethod(ObjT* obj, Method method, const A& arg) { 643 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg)); 644 } 645 646 template <class ObjT, class Method, class A> 647 inline void DispatchToMethod(ObjT* obj, Method method, const Tuple1<A>& arg) { 648 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a)); 649 } 650 651 template <class ObjT, class Method, class A, class B> 652 inline void DispatchToMethod(ObjT* obj, 653 Method method, 654 const Tuple2<A, B>& arg) { 655 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 656 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b)); 657 } 658 659 template <class ObjT, class Method, class A, class B, class C> 660 inline void DispatchToMethod(ObjT* obj, 661 Method method, 662 const Tuple3<A, B, C>& arg) { 663 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 664 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 665 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c)); 666 } 667 668 template <class ObjT, class Method, class A, class B, class C, class D> 669 inline void DispatchToMethod(ObjT* obj, 670 Method method, 671 const Tuple4<A, B, C, D>& arg) { 672 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 673 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 674 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 675 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d)); 676 } 677 678 template <class ObjT, class Method, class A, class B, class C, class D, class E> 679 inline void DispatchToMethod(ObjT* obj, 680 Method method, 681 const Tuple5<A, B, C, D, E>& arg) { 682 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 683 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 684 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 685 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 686 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e)); 687 } 688 689 template <class ObjT, 690 class Method, 691 class A, 692 class B, 693 class C, 694 class D, 695 class E, 696 class F> 697 inline void DispatchToMethod(ObjT* obj, 698 Method method, 699 const Tuple6<A, B, C, D, E, F>& arg) { 700 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 701 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 702 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 703 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 704 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e), 705 base::cef_internal::UnwrapTraits<F>::Unwrap(arg.f)); 706 } 707 708 template <class ObjT, 709 class Method, 710 class A, 711 class B, 712 class C, 713 class D, 714 class E, 715 class F, 716 class G> 717 inline void DispatchToMethod(ObjT* obj, 718 Method method, 719 const Tuple7<A, B, C, D, E, F, G>& arg) { 720 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 721 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 722 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 723 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 724 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e), 725 base::cef_internal::UnwrapTraits<F>::Unwrap(arg.f), 726 base::cef_internal::UnwrapTraits<G>::Unwrap(arg.g)); 727 } 728 729 template <class ObjT, 730 class Method, 731 class A, 732 class B, 733 class C, 734 class D, 735 class E, 736 class F, 737 class G, 738 class H> 739 inline void DispatchToMethod(ObjT* obj, 740 Method method, 741 const Tuple8<A, B, C, D, E, F, G, H>& arg) { 742 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 743 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 744 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 745 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 746 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e), 747 base::cef_internal::UnwrapTraits<F>::Unwrap(arg.f), 748 base::cef_internal::UnwrapTraits<G>::Unwrap(arg.g), 749 base::cef_internal::UnwrapTraits<H>::Unwrap(arg.h)); 750 } 751 752 // Static Dispatchers with no out params. 753 754 template <class Function> 755 inline void DispatchToFunction(Function function, const Tuple0& arg) { 756 (*function)(); 757 } 758 759 template <class Function, class A> 760 inline void DispatchToFunction(Function function, const A& arg) { 761 (*function)(arg); 762 } 763 764 template <class Function, class A> 765 inline void DispatchToFunction(Function function, const Tuple1<A>& arg) { 766 (*function)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a)); 767 } 768 769 template <class Function, class A, class B> 770 inline void DispatchToFunction(Function function, const Tuple2<A, B>& arg) { 771 (*function)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 772 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b)); 773 } 774 775 template <class Function, class A, class B, class C> 776 inline void DispatchToFunction(Function function, const Tuple3<A, B, C>& arg) { 777 (*function)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 778 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 779 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c)); 780 } 781 782 template <class Function, class A, class B, class C, class D> 783 inline void DispatchToFunction(Function function, 784 const Tuple4<A, B, C, D>& arg) { 785 (*function)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 786 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 787 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 788 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d)); 789 } 790 791 template <class Function, class A, class B, class C, class D, class E> 792 inline void DispatchToFunction(Function function, 793 const Tuple5<A, B, C, D, E>& arg) { 794 (*function)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 795 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 796 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 797 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 798 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e)); 799 } 800 801 template <class Function, class A, class B, class C, class D, class E, class F> 802 inline void DispatchToFunction(Function function, 803 const Tuple6<A, B, C, D, E, F>& arg) { 804 (*function)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 805 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 806 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 807 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 808 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e), 809 base::cef_internal::UnwrapTraits<F>::Unwrap(arg.f)); 810 } 811 812 template <class Function, 813 class A, 814 class B, 815 class C, 816 class D, 817 class E, 818 class F, 819 class G> 820 inline void DispatchToFunction(Function function, 821 const Tuple7<A, B, C, D, E, F, G>& arg) { 822 (*function)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 823 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 824 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 825 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 826 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e), 827 base::cef_internal::UnwrapTraits<F>::Unwrap(arg.f), 828 base::cef_internal::UnwrapTraits<G>::Unwrap(arg.g)); 829 } 830 831 template <class Function, 832 class A, 833 class B, 834 class C, 835 class D, 836 class E, 837 class F, 838 class G, 839 class H> 840 inline void DispatchToFunction(Function function, 841 const Tuple8<A, B, C, D, E, F, G, H>& arg) { 842 (*function)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 843 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 844 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 845 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 846 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e), 847 base::cef_internal::UnwrapTraits<F>::Unwrap(arg.f), 848 base::cef_internal::UnwrapTraits<G>::Unwrap(arg.g), 849 base::cef_internal::UnwrapTraits<H>::Unwrap(arg.h)); 850 } 851 852 // Dispatchers with 0 out param (as a Tuple0). 853 854 template <class ObjT, class Method> 855 inline void DispatchToMethod(ObjT* obj, 856 Method method, 857 const Tuple0& arg, 858 Tuple0*) { 859 (obj->*method)(); 860 } 861 862 template <class ObjT, class Method, class A> 863 inline void DispatchToMethod(ObjT* obj, Method method, const A& arg, Tuple0*) { 864 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg)); 865 } 866 867 template <class ObjT, class Method, class A> 868 inline void DispatchToMethod(ObjT* obj, 869 Method method, 870 const Tuple1<A>& arg, 871 Tuple0*) { 872 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a)); 873 } 874 875 template <class ObjT, class Method, class A, class B> 876 inline void DispatchToMethod(ObjT* obj, 877 Method method, 878 const Tuple2<A, B>& arg, 879 Tuple0*) { 880 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 881 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b)); 882 } 883 884 template <class ObjT, class Method, class A, class B, class C> 885 inline void DispatchToMethod(ObjT* obj, 886 Method method, 887 const Tuple3<A, B, C>& arg, 888 Tuple0*) { 889 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 890 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 891 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c)); 892 } 893 894 template <class ObjT, class Method, class A, class B, class C, class D> 895 inline void DispatchToMethod(ObjT* obj, 896 Method method, 897 const Tuple4<A, B, C, D>& arg, 898 Tuple0*) { 899 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 900 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 901 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 902 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d)); 903 } 904 905 template <class ObjT, class Method, class A, class B, class C, class D, class E> 906 inline void DispatchToMethod(ObjT* obj, 907 Method method, 908 const Tuple5<A, B, C, D, E>& arg, 909 Tuple0*) { 910 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 911 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 912 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 913 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 914 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e)); 915 } 916 917 template <class ObjT, 918 class Method, 919 class A, 920 class B, 921 class C, 922 class D, 923 class E, 924 class F> 925 inline void DispatchToMethod(ObjT* obj, 926 Method method, 927 const Tuple6<A, B, C, D, E, F>& arg, 928 Tuple0*) { 929 (obj->*method)(base::cef_internal::UnwrapTraits<A>::Unwrap(arg.a), 930 base::cef_internal::UnwrapTraits<B>::Unwrap(arg.b), 931 base::cef_internal::UnwrapTraits<C>::Unwrap(arg.c), 932 base::cef_internal::UnwrapTraits<D>::Unwrap(arg.d), 933 base::cef_internal::UnwrapTraits<E>::Unwrap(arg.e), 934 base::cef_internal::UnwrapTraits<F>::Unwrap(arg.f)); 935 } 936 937 // Dispatchers with 1 out param. 938 939 template <class ObjT, class Method, class OutA> 940 inline void DispatchToMethod(ObjT* obj, 941 Method method, 942 const Tuple0& in, 943 Tuple1<OutA>* out) { 944 (obj->*method)(&out->a); 945 } 946 947 template <class ObjT, class Method, class InA, class OutA> 948 inline void DispatchToMethod(ObjT* obj, 949 Method method, 950 const InA& in, 951 Tuple1<OutA>* out) { 952 (obj->*method)(in, &out->a); 953 } 954 955 template <class ObjT, class Method, class InA, class OutA> 956 inline void DispatchToMethod(ObjT* obj, 957 Method method, 958 const Tuple1<InA>& in, 959 Tuple1<OutA>* out) { 960 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), &out->a); 961 } 962 963 template <class ObjT, class Method, class InA, class InB, class OutA> 964 inline void DispatchToMethod(ObjT* obj, 965 Method method, 966 const Tuple2<InA, InB>& in, 967 Tuple1<OutA>* out) { 968 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 969 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), &out->a); 970 } 971 972 template <class ObjT, class Method, class InA, class InB, class InC, class OutA> 973 inline void DispatchToMethod(ObjT* obj, 974 Method method, 975 const Tuple3<InA, InB, InC>& in, 976 Tuple1<OutA>* out) { 977 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 978 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 979 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), &out->a); 980 } 981 982 template <class ObjT, 983 class Method, 984 class InA, 985 class InB, 986 class InC, 987 class InD, 988 class OutA> 989 inline void DispatchToMethod(ObjT* obj, 990 Method method, 991 const Tuple4<InA, InB, InC, InD>& in, 992 Tuple1<OutA>* out) { 993 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 994 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 995 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 996 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), &out->a); 997 } 998 999 template <class ObjT, 1000 class Method, 1001 class InA, 1002 class InB, 1003 class InC, 1004 class InD, 1005 class InE, 1006 class OutA> 1007 inline void DispatchToMethod(ObjT* obj, 1008 Method method, 1009 const Tuple5<InA, InB, InC, InD, InE>& in, 1010 Tuple1<OutA>* out) { 1011 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1012 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1013 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1014 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1015 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), &out->a); 1016 } 1017 1018 template <class ObjT, 1019 class Method, 1020 class InA, 1021 class InB, 1022 class InC, 1023 class InD, 1024 class InE, 1025 class InF, 1026 class OutA> 1027 inline void DispatchToMethod(ObjT* obj, 1028 Method method, 1029 const Tuple6<InA, InB, InC, InD, InE, InF>& in, 1030 Tuple1<OutA>* out) { 1031 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1032 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1033 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1034 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1035 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), 1036 base::cef_internal::UnwrapTraits<InF>::Unwrap(in.f), &out->a); 1037 } 1038 1039 // Dispatchers with 2 out params. 1040 1041 template <class ObjT, class Method, class OutA, class OutB> 1042 inline void DispatchToMethod(ObjT* obj, 1043 Method method, 1044 const Tuple0& in, 1045 Tuple2<OutA, OutB>* out) { 1046 (obj->*method)(&out->a, &out->b); 1047 } 1048 1049 template <class ObjT, class Method, class InA, class OutA, class OutB> 1050 inline void DispatchToMethod(ObjT* obj, 1051 Method method, 1052 const InA& in, 1053 Tuple2<OutA, OutB>* out) { 1054 (obj->*method)(in, &out->a, &out->b); 1055 } 1056 1057 template <class ObjT, class Method, class InA, class OutA, class OutB> 1058 inline void DispatchToMethod(ObjT* obj, 1059 Method method, 1060 const Tuple1<InA>& in, 1061 Tuple2<OutA, OutB>* out) { 1062 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), &out->a, 1063 &out->b); 1064 } 1065 1066 template <class ObjT, 1067 class Method, 1068 class InA, 1069 class InB, 1070 class OutA, 1071 class OutB> 1072 inline void DispatchToMethod(ObjT* obj, 1073 Method method, 1074 const Tuple2<InA, InB>& in, 1075 Tuple2<OutA, OutB>* out) { 1076 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1077 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), &out->a, 1078 &out->b); 1079 } 1080 1081 template <class ObjT, 1082 class Method, 1083 class InA, 1084 class InB, 1085 class InC, 1086 class OutA, 1087 class OutB> 1088 inline void DispatchToMethod(ObjT* obj, 1089 Method method, 1090 const Tuple3<InA, InB, InC>& in, 1091 Tuple2<OutA, OutB>* out) { 1092 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1093 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1094 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), &out->a, 1095 &out->b); 1096 } 1097 1098 template <class ObjT, 1099 class Method, 1100 class InA, 1101 class InB, 1102 class InC, 1103 class InD, 1104 class OutA, 1105 class OutB> 1106 inline void DispatchToMethod(ObjT* obj, 1107 Method method, 1108 const Tuple4<InA, InB, InC, InD>& in, 1109 Tuple2<OutA, OutB>* out) { 1110 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1111 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1112 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1113 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), &out->a, 1114 &out->b); 1115 } 1116 1117 template <class ObjT, 1118 class Method, 1119 class InA, 1120 class InB, 1121 class InC, 1122 class InD, 1123 class InE, 1124 class OutA, 1125 class OutB> 1126 inline void DispatchToMethod(ObjT* obj, 1127 Method method, 1128 const Tuple5<InA, InB, InC, InD, InE>& in, 1129 Tuple2<OutA, OutB>* out) { 1130 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1131 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1132 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1133 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1134 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), &out->a, 1135 &out->b); 1136 } 1137 1138 template <class ObjT, 1139 class Method, 1140 class InA, 1141 class InB, 1142 class InC, 1143 class InD, 1144 class InE, 1145 class InF, 1146 class OutA, 1147 class OutB> 1148 inline void DispatchToMethod(ObjT* obj, 1149 Method method, 1150 const Tuple6<InA, InB, InC, InD, InE, InF>& in, 1151 Tuple2<OutA, OutB>* out) { 1152 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1153 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1154 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1155 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1156 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), 1157 base::cef_internal::UnwrapTraits<InF>::Unwrap(in.f), &out->a, 1158 &out->b); 1159 } 1160 1161 // Dispatchers with 3 out params. 1162 1163 template <class ObjT, class Method, class OutA, class OutB, class OutC> 1164 inline void DispatchToMethod(ObjT* obj, 1165 Method method, 1166 const Tuple0& in, 1167 Tuple3<OutA, OutB, OutC>* out) { 1168 (obj->*method)(&out->a, &out->b, &out->c); 1169 } 1170 1171 template <class ObjT, 1172 class Method, 1173 class InA, 1174 class OutA, 1175 class OutB, 1176 class OutC> 1177 inline void DispatchToMethod(ObjT* obj, 1178 Method method, 1179 const InA& in, 1180 Tuple3<OutA, OutB, OutC>* out) { 1181 (obj->*method)(in, &out->a, &out->b, &out->c); 1182 } 1183 1184 template <class ObjT, 1185 class Method, 1186 class InA, 1187 class OutA, 1188 class OutB, 1189 class OutC> 1190 inline void DispatchToMethod(ObjT* obj, 1191 Method method, 1192 const Tuple1<InA>& in, 1193 Tuple3<OutA, OutB, OutC>* out) { 1194 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), &out->a, 1195 &out->b, &out->c); 1196 } 1197 1198 template <class ObjT, 1199 class Method, 1200 class InA, 1201 class InB, 1202 class OutA, 1203 class OutB, 1204 class OutC> 1205 inline void DispatchToMethod(ObjT* obj, 1206 Method method, 1207 const Tuple2<InA, InB>& in, 1208 Tuple3<OutA, OutB, OutC>* out) { 1209 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1210 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), &out->a, 1211 &out->b, &out->c); 1212 } 1213 1214 template <class ObjT, 1215 class Method, 1216 class InA, 1217 class InB, 1218 class InC, 1219 class OutA, 1220 class OutB, 1221 class OutC> 1222 inline void DispatchToMethod(ObjT* obj, 1223 Method method, 1224 const Tuple3<InA, InB, InC>& in, 1225 Tuple3<OutA, OutB, OutC>* out) { 1226 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1227 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1228 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), &out->a, 1229 &out->b, &out->c); 1230 } 1231 1232 template <class ObjT, 1233 class Method, 1234 class InA, 1235 class InB, 1236 class InC, 1237 class InD, 1238 class OutA, 1239 class OutB, 1240 class OutC> 1241 inline void DispatchToMethod(ObjT* obj, 1242 Method method, 1243 const Tuple4<InA, InB, InC, InD>& in, 1244 Tuple3<OutA, OutB, OutC>* out) { 1245 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1246 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1247 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1248 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), &out->a, 1249 &out->b, &out->c); 1250 } 1251 1252 template <class ObjT, 1253 class Method, 1254 class InA, 1255 class InB, 1256 class InC, 1257 class InD, 1258 class InE, 1259 class OutA, 1260 class OutB, 1261 class OutC> 1262 inline void DispatchToMethod(ObjT* obj, 1263 Method method, 1264 const Tuple5<InA, InB, InC, InD, InE>& in, 1265 Tuple3<OutA, OutB, OutC>* out) { 1266 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1267 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1268 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1269 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1270 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), &out->a, 1271 &out->b, &out->c); 1272 } 1273 1274 template <class ObjT, 1275 class Method, 1276 class InA, 1277 class InB, 1278 class InC, 1279 class InD, 1280 class InE, 1281 class InF, 1282 class OutA, 1283 class OutB, 1284 class OutC> 1285 inline void DispatchToMethod(ObjT* obj, 1286 Method method, 1287 const Tuple6<InA, InB, InC, InD, InE, InF>& in, 1288 Tuple3<OutA, OutB, OutC>* out) { 1289 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1290 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1291 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1292 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1293 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), 1294 base::cef_internal::UnwrapTraits<InF>::Unwrap(in.f), &out->a, 1295 &out->b, &out->c); 1296 } 1297 1298 // Dispatchers with 4 out params. 1299 1300 template <class ObjT, 1301 class Method, 1302 class OutA, 1303 class OutB, 1304 class OutC, 1305 class OutD> 1306 inline void DispatchToMethod(ObjT* obj, 1307 Method method, 1308 const Tuple0& in, 1309 Tuple4<OutA, OutB, OutC, OutD>* out) { 1310 (obj->*method)(&out->a, &out->b, &out->c, &out->d); 1311 } 1312 1313 template <class ObjT, 1314 class Method, 1315 class InA, 1316 class OutA, 1317 class OutB, 1318 class OutC, 1319 class OutD> 1320 inline void DispatchToMethod(ObjT* obj, 1321 Method method, 1322 const InA& in, 1323 Tuple4<OutA, OutB, OutC, OutD>* out) { 1324 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in), &out->a, 1325 &out->b, &out->c, &out->d); 1326 } 1327 1328 template <class ObjT, 1329 class Method, 1330 class InA, 1331 class OutA, 1332 class OutB, 1333 class OutC, 1334 class OutD> 1335 inline void DispatchToMethod(ObjT* obj, 1336 Method method, 1337 const Tuple1<InA>& in, 1338 Tuple4<OutA, OutB, OutC, OutD>* out) { 1339 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), &out->a, 1340 &out->b, &out->c, &out->d); 1341 } 1342 1343 template <class ObjT, 1344 class Method, 1345 class InA, 1346 class InB, 1347 class OutA, 1348 class OutB, 1349 class OutC, 1350 class OutD> 1351 inline void DispatchToMethod(ObjT* obj, 1352 Method method, 1353 const Tuple2<InA, InB>& in, 1354 Tuple4<OutA, OutB, OutC, OutD>* out) { 1355 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1356 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), &out->a, 1357 &out->b, &out->c, &out->d); 1358 } 1359 1360 template <class ObjT, 1361 class Method, 1362 class InA, 1363 class InB, 1364 class InC, 1365 class OutA, 1366 class OutB, 1367 class OutC, 1368 class OutD> 1369 inline void DispatchToMethod(ObjT* obj, 1370 Method method, 1371 const Tuple3<InA, InB, InC>& in, 1372 Tuple4<OutA, OutB, OutC, OutD>* out) { 1373 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1374 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1375 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), &out->a, 1376 &out->b, &out->c, &out->d); 1377 } 1378 1379 template <class ObjT, 1380 class Method, 1381 class InA, 1382 class InB, 1383 class InC, 1384 class InD, 1385 class OutA, 1386 class OutB, 1387 class OutC, 1388 class OutD> 1389 inline void DispatchToMethod(ObjT* obj, 1390 Method method, 1391 const Tuple4<InA, InB, InC, InD>& in, 1392 Tuple4<OutA, OutB, OutC, OutD>* out) { 1393 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1394 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1395 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1396 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), &out->a, 1397 &out->b, &out->c, &out->d); 1398 } 1399 1400 template <class ObjT, 1401 class Method, 1402 class InA, 1403 class InB, 1404 class InC, 1405 class InD, 1406 class InE, 1407 class OutA, 1408 class OutB, 1409 class OutC, 1410 class OutD> 1411 inline void DispatchToMethod(ObjT* obj, 1412 Method method, 1413 const Tuple5<InA, InB, InC, InD, InE>& in, 1414 Tuple4<OutA, OutB, OutC, OutD>* out) { 1415 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1416 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1417 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1418 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1419 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), &out->a, 1420 &out->b, &out->c, &out->d); 1421 } 1422 1423 template <class ObjT, 1424 class Method, 1425 class InA, 1426 class InB, 1427 class InC, 1428 class InD, 1429 class InE, 1430 class InF, 1431 class OutA, 1432 class OutB, 1433 class OutC, 1434 class OutD> 1435 inline void DispatchToMethod(ObjT* obj, 1436 Method method, 1437 const Tuple6<InA, InB, InC, InD, InE, InF>& in, 1438 Tuple4<OutA, OutB, OutC, OutD>* out) { 1439 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1440 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1441 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1442 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1443 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), 1444 base::cef_internal::UnwrapTraits<InF>::Unwrap(in.f), &out->a, 1445 &out->b, &out->c, &out->d); 1446 } 1447 1448 // Dispatchers with 5 out params. 1449 1450 template <class ObjT, 1451 class Method, 1452 class OutA, 1453 class OutB, 1454 class OutC, 1455 class OutD, 1456 class OutE> 1457 inline void DispatchToMethod(ObjT* obj, 1458 Method method, 1459 const Tuple0& in, 1460 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { 1461 (obj->*method)(&out->a, &out->b, &out->c, &out->d, &out->e); 1462 } 1463 1464 template <class ObjT, 1465 class Method, 1466 class InA, 1467 class OutA, 1468 class OutB, 1469 class OutC, 1470 class OutD, 1471 class OutE> 1472 inline void DispatchToMethod(ObjT* obj, 1473 Method method, 1474 const InA& in, 1475 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { 1476 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in), &out->a, 1477 &out->b, &out->c, &out->d, &out->e); 1478 } 1479 1480 template <class ObjT, 1481 class Method, 1482 class InA, 1483 class OutA, 1484 class OutB, 1485 class OutC, 1486 class OutD, 1487 class OutE> 1488 inline void DispatchToMethod(ObjT* obj, 1489 Method method, 1490 const Tuple1<InA>& in, 1491 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { 1492 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), &out->a, 1493 &out->b, &out->c, &out->d, &out->e); 1494 } 1495 1496 template <class ObjT, 1497 class Method, 1498 class InA, 1499 class InB, 1500 class OutA, 1501 class OutB, 1502 class OutC, 1503 class OutD, 1504 class OutE> 1505 inline void DispatchToMethod(ObjT* obj, 1506 Method method, 1507 const Tuple2<InA, InB>& in, 1508 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { 1509 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1510 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), &out->a, 1511 &out->b, &out->c, &out->d, &out->e); 1512 } 1513 1514 template <class ObjT, 1515 class Method, 1516 class InA, 1517 class InB, 1518 class InC, 1519 class OutA, 1520 class OutB, 1521 class OutC, 1522 class OutD, 1523 class OutE> 1524 inline void DispatchToMethod(ObjT* obj, 1525 Method method, 1526 const Tuple3<InA, InB, InC>& in, 1527 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { 1528 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1529 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1530 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), &out->a, 1531 &out->b, &out->c, &out->d, &out->e); 1532 } 1533 1534 template <class ObjT, 1535 class Method, 1536 class InA, 1537 class InB, 1538 class InC, 1539 class InD, 1540 class OutA, 1541 class OutB, 1542 class OutC, 1543 class OutD, 1544 class OutE> 1545 inline void DispatchToMethod(ObjT* obj, 1546 Method method, 1547 const Tuple4<InA, InB, InC, InD>& in, 1548 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { 1549 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1550 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1551 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1552 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), &out->a, 1553 &out->b, &out->c, &out->d, &out->e); 1554 } 1555 1556 template <class ObjT, 1557 class Method, 1558 class InA, 1559 class InB, 1560 class InC, 1561 class InD, 1562 class InE, 1563 class OutA, 1564 class OutB, 1565 class OutC, 1566 class OutD, 1567 class OutE> 1568 inline void DispatchToMethod(ObjT* obj, 1569 Method method, 1570 const Tuple5<InA, InB, InC, InD, InE>& in, 1571 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { 1572 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1573 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1574 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1575 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1576 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), &out->a, 1577 &out->b, &out->c, &out->d, &out->e); 1578 } 1579 1580 template <class ObjT, 1581 class Method, 1582 class InA, 1583 class InB, 1584 class InC, 1585 class InD, 1586 class InE, 1587 class InF, 1588 class OutA, 1589 class OutB, 1590 class OutC, 1591 class OutD, 1592 class OutE> 1593 inline void DispatchToMethod(ObjT* obj, 1594 Method method, 1595 const Tuple6<InA, InB, InC, InD, InE, InF>& in, 1596 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { 1597 (obj->*method)(base::cef_internal::UnwrapTraits<InA>::Unwrap(in.a), 1598 base::cef_internal::UnwrapTraits<InB>::Unwrap(in.b), 1599 base::cef_internal::UnwrapTraits<InC>::Unwrap(in.c), 1600 base::cef_internal::UnwrapTraits<InD>::Unwrap(in.d), 1601 base::cef_internal::UnwrapTraits<InE>::Unwrap(in.e), 1602 base::cef_internal::UnwrapTraits<InF>::Unwrap(in.f), &out->a, 1603 &out->b, &out->c, &out->d, &out->e); 1604 } 1605 1606 } // namespace base 1607 1608 #endif // !USING_CHROMIUM_INCLUDES 1609 1610 #endif // CEF_INCLUDE_BASE_CEF_TUPLE_H_ 1611