1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/*
Copyright (C) 2016 Alexander Borisov
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Author: lex.borisov@gmail.com (Alexander Borisov)
*/
#ifndef MODEST_FINDER_THREAD_H
#define MODEST_FINDER_THREAD_H
#pragma once
#include <modest/modest.h>
#include <modest/node/node.h>
#include <modest/style/type.h>
#include <modest/style/map.h>
#include <modest/finder/myosi.h>
#include <modest/finder/finder.h>
#include <myhtml/thread.h>
#include <myhtml/utils/mcobject_async.h>
#include <mycss/declaration/myosi.h>
#ifdef __cplusplus
extern "C" {
#endif
struct modest_finder_thread_declaration {
mycss_declaration_entry_t* entry;
modest_style_raw_specificity_t raw_spec;
struct modest_finder_thread_declaration* next;
struct modest_finder_thread_declaration* prev;
};
struct modest_finder_thread_entry {
myhtml_tree_node_t* node;
modest_finder_thread_declaration_t* declaration;
modest_finder_thread_declaration_t* declaration_last;
struct modest_finder_thread_entry* next;
struct modest_finder_thread_entry* prev;
};
struct modest_finder_thread_context {
modest_finder_thread_entry_t* entry;
modest_finder_thread_entry_t* entry_last;
size_t entry_node_id;
size_t declaration_node_id;
};
struct modest_finder_thread {
modest_finder_thread_context_t* context_list;
size_t context_list_size;
mythread_t *thread;
mcobject_async_t* entry_obj;
mcobject_async_t* declaration_obj;
/* refs */
modest_finder_t* finder;
myhtml_tree_node_t* base_node;
mycss_selectors_list_t* selector_list;
};
struct modest_finder_thread_found_context {
modest_finder_thread_t* finder_thread;
modest_finder_thread_context_t* context;
};
modest_finder_thread_t * modest_finder_thread_create(void);
modest_status_t modest_finder_thread_init(modest_finder_t* finder, modest_finder_thread_t* finder_thread, size_t thread_count);
void modest_finder_thread_clean(modest_finder_thread_t* finder_thread, bool self_destroy);
modest_finder_thread_t * modest_finder_thread_destroy(modest_finder_thread_t* finder_thread, bool self_destroy);
modest_status_t modest_finder_thread_process(modest_t* modest, modest_finder_thread_t* finder_thread, myhtml_tree_node_t* scope_node, mycss_selectors_list_t* selector_list);
void modest_finder_thread_wait_for_all_done(modest_finder_thread_t* finder_thread);
bool modest_finder_thread_spec_is_up(modest_style_raw_specificity_t* spec_f, modest_style_raw_specificity_t* spec_t);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* thread_h */
|