首页 > cef > CEF-CefPostTask简介
2017九月4

CEF-CefPostTask简介

有几种方式

#include "include/cef_runnable.h"

CefPostTask(TID_UI, NewCefRunnableMethod(this,&DUINativeWeb::OpenUrl,pszURL,iFlags,pszTargetFrameName,pszHeaders,pszPostData,iPostDataLen));

或者

#include "include/base/cef_bind.h"

#include "include/base/cef_bind_helpers.h"

#include "wrapper/cef_closure_task.h"

CefPostTask(TID_UI, base::Bind(base::IgnoreResult(&DUINativeWeb::OpenUrl),this,pszURL,iFlags,pszTargetFrameName,pszHeaders,pszPostData,iPostDataLen));

或者自己重载task

官方的解释总是最权威,有疑问看这里或者直接看代码中的说明: bind_helpers.h. 

传值方式 描述
this 或 对象指针

如果对象本身是一个RefCountedThreadSafe, 没有问题.

如果是个裸指针,应当尽量避免,除非你可以保证它的线程安全.

base::Unretained

注意:使用这个的前提是有其它同步机制保障对象的生命周期.

  1. 如果有其它同步机制保障对象的生命周期,可以使用Unretained()传递非引用计数的对象.

  2. 如果是一个非引用计数的对象,可以使用Unretained()封装起来.

base::Owned

如果是临时对象,或者担心任务执行完成后对象可能出现泄露,可以使用Owned, 表示由Task

持有对象的所有权,在结束时析构它.

base::Passed 如果要执行Task需要传入scoped指针,就可以使用它转换,它也可以避免拷贝,而是类似move语义.
base::ConstRef 类似常量引用,不希望bind过程出现拷贝,就可以使用它.
base::IgnoreResult 如果Task要调用的方法带有返回值,而你又不关心返回值就可以使用IgnoreResult来传入对象指针.

 

文章作者:hgy413
本文地址:https://hgy413.com/4249.html
版权所有 © 转载时必须以链接形式注明作者和原始出处!

32 Responses to “CEF-CefPostTask简介”

  1. #1 minecraft 回复 | 引用 Post:2018-10-04 20:02

    I know this web page presents quality dependent posts and extra information, is there any other website
    which presents such things in quality?

  2. #2 minecraft 回复 | 引用 Post:2018-10-07 16:09

    Hello, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam comments?
    If so how do you reduce it, any plugin or anything
    you can recommend? I get so much lately it’s driving me mad so any support is very much appreciated.

  3. Excellent blog you have here but I was wanting to know if you knew
    of any user discussion forums that cover the same topics discussed here?
    I’d really like to be a part of online community where
    I can get responses from other knowledgeable individuals that share the same interest.

    If you have any recommendations, please let me know.
    Appreciate it!

  4. I am regular visitor, how are you everybody? This post
    posted at this web page is in fact fastidious.

  5. Hello it’s me, I am also visiting this web page on a regular basis,
    this web site is really pleasant and the people are really sharing nice thoughts.

  6. #6 tinder dating site 回复 | 引用 Post:2018-10-17 12:23

    When someone writes an post he/she keeps the thought of a user in his/her brain that how a user can know it.
    Therefore that’s why this article is great. Thanks!

  7. #7 Coconut Oil Benefits 回复 | 引用 Post:2018-10-21 08:21

    Great beat ! I would like to apprentice while you amend
    your website, how can i subscribe for a blog website?
    The account helped me a appropriate deal. I had been a little bit familiar of this your broadcast offered shiny clear concept

  8. #8 Coconut Oil 回复 | 引用 Post:2018-10-24 17:22

    I am sure this post has touched all the internet visitors, its really really good paragraph on building up
    new webpage.

  9. #9 quest bars cheap 回复 | 引用 Post:2018-11-03 16:24

    Its not my first time to go to see this web page, i am browsing this web page dailly and
    get good information from here daily.

  10. #10 quest bars 回复 | 引用 Post:2018-11-05 01:55

    Awesome article.

  11. #11 Quest Bars Cheap 回复 | 引用 Post:2018-11-07 01:03

    Hey I know this is off topic but I was wondering if you knew of any widgets I could add to
    my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite
    some time and was hoping maybe you would have some experience with something like this.

    Please let me know if you run into anything. I truly enjoy reading your
    blog and I look forward to your new updates.

  12. #12 Sling TV 回复 | 引用 Post:2018-11-14 14:20

    I have been exploring for a little for any high quality
    articles or weblog posts on this sort of house .
    Exploring in Yahoo I ultimately stumbled upon this web site.
    Reading this info So i’m glad to express that I have a very just right uncanny feeling I came upon exactly what I
    needed. I such a lot no doubt will make certain to do not overlook
    this site and give it a glance regularly.

  13. I think the admin of this website is actually working
    hard in support of his website, as here every data is quality based material.

  14. Hey I am so excited I found your weblog, I really found you by mistake,
    while I was searching on Askjeeve for something
    else, Anyhow I am here now and would just like to say thank you for
    a incredible post and a all round enjoyable blog (I also love the theme/design),
    I don’t have time to go through it all at the minute but I have saved it and also added your RSS feeds, so when I have time I will be back to read a great deal more,
    Please do keep up the awesome work.

  15. #15 descargar facebook 回复 | 引用 Post:2018-11-21 07:23

    Hi there, You’ve done a great job. I will definitely digg it and personally recommend to
    my friends. I am confident they will be benefited from this website.

  16. #16 descargar facebook 回复 | 引用 Post:2018-12-06 05:48

    Great article, exactly what I wanted to find.

  17. #17 Virgie 回复 | 引用 Post:2020-05-10 04:38

    My spouse and I stumbled over here from a different website and thought I may as well check
    things out. I like what I see so i am just following you.

    Look forward to checking out your web page for a second time.

  18. #18 https://issuu.com 回复 | 引用 Post:2020-05-11 06:07

    It?s difficult to find experienced people in this particular topic, but you seem like you know what you?re talking about!
    Thanks

  19. #19 www.instructables.com 回复 | 引用 Post:2020-05-11 06:59

    Whoa! This blog looks just like my old one! It’s on a entirely different topic but it has
    pretty much the same page layout and design. Outstanding choice of colors!

  20. #20 https://bitly.su/0p5I 回复 | 引用 Post:2020-05-12 07:57

    You are a very intelligent person!

  21. #21 Teresa 回复 | 引用 Post:2020-05-13 07:47

    Heya i’m for the primary time here. I came across this board and I find
    It truly useful & it helped me out a lot. I hope
    to give one thing again and help others such as you aided me.

  22. It’s really a cool and useful piece of information. I am happy that you shared this useful
    information with us. Please stay us informed like this.

    Thanks for sharing.

  23. #23 https://issuu.com/ 回复 | 引用 Post:2020-05-17 11:05

    I hardly leave comments, however i did some searching and wound up here blog topic.

    And I actually do have a couple of questions for you if it’s allright.
    Could it be simply me or does it look like some of the comments look like they are
    coming from brain dead people? 😛 And, if you are writing at additional social sites, I would like to follow anything new you have to post.
    Would you make a list of the complete urls of all your
    shared sites like your Facebook page, twitter feed, or linkedin profile?

  24. #24 hongkong pool 回复 | 引用 Post:2020-06-05 21:23

    Way cool! Some extremely valid points! I appreciate you penning this write-up and also the rest of the site is really good.

  25. #25 g here 回复 | 引用 Post:2020-06-10 20:11

    Right away I am going away to do my breakfast, after having my breakfast coming yet
    again to read additional news.

  26. #26 g now 回复 | 引用 Post:2020-06-10 20:37

    Hello, I enjoy reading through your article.
    I like to write a little comment to support you.

  27. #27 g it 回复 | 引用 Post:2020-06-11 19:13

    Appreciation to my father who shared with
    me concerning this webpage, this webpage is really amazing.

  28. #28 g 回复 | 引用 Post:2020-06-12 20:27

    This text is invaluable. When can I find out more?

  29. #29 king of avalon cheats 回复 | 引用 Post:2020-06-14 07:30

    I got this web page from my pal who shared with me regarding this web
    page and now this time I am browsing this site
    and reading very informative posts at this place.

  30. #30 hack afk arena 回复 | 引用 Post:2020-06-14 09:46

    Hey there, You’ve done a fantastic job. I’ll certainly digg it and personally recommend to my friends.
    I’m sure they will be benefited from this website.

  31. #31 directory.themixup2.com 回复 | 引用 Post:2020-06-14 12:02

    Hey there! Quick question that’s totally off topic. Do you know how to
    make your site mobile friendly? My site looks weird when browsing from my apple iphone.
    I’m trying to find a theme or plugin that might be able to fix this issue.
    If you have any recommendations, please share. Appreciate it!

  32. #32 www.d1598.com 回复 | 引用 Post:2020-06-14 13:08

    We’re a group of volunteers and opening a new scheme in our community.
    Your web site offered us with valuable info to work on.
    You have done a formidable job and our entire community will be thankful to you.

发表评论